ghost-portal/packages/react-components/src/InfoForInput.tsx
Jaco 2bf56dbf11
Adjust styled injection (final round) (#8814)
* Adjust styled injection (final round)

* Fix (some) build issues

* Fix (some more) build errors

* ... it builds (... ship it!)
2023-01-15 19:53:55 +02:00

45 lines
911 B
TypeScript

// Copyright 2017-2023 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React from 'react';
import styled from 'styled-components';
import Labelled from './Labelled';
interface Props {
children: React.ReactNode;
className?: string;
type?: 'error' | 'info' | 'warning';
}
function InfoForInput ({ children, className = '', type = 'info' }: Props): React.ReactElement<Props> {
return (
<StyledLabelled>
<div className={`${className} ${type}`}>{children}</div>
</StyledLabelled>
);
}
const StyledLabelled = styled(Labelled)`
background: white;
border-radius: 0 0 0.25rem 0.25rem;
margin: -0.5rem 0 0.25rem;
padding: 1.25rem 1.5rem 1rem;
&.error {
background: #db2828;
color: #eee;
}
&.warning {
background: #ffffe0;
}
> ul {
margin: 0;
padding: 0;
}
`;
export default React.memo(InfoForInput);