@@ -4,12 +4,25 @@ import styled from '@emotion/styled';
|
||||
const StyledInputErrorHelper = styled.div`
|
||||
color: ${({ theme }) => theme.color.red};
|
||||
font-size: ${({ theme }) => theme.font.size.xs};
|
||||
position: absolute;
|
||||
`;
|
||||
|
||||
const StyledErrorContainer = styled.div`
|
||||
margin-top: ${({ theme }) => theme.spacing(1)};
|
||||
`;
|
||||
|
||||
export const InputErrorHelper = ({
|
||||
children,
|
||||
isVisible = true,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
isVisible?: boolean;
|
||||
}) => (
|
||||
<StyledInputErrorHelper aria-live="polite">{children}</StyledInputErrorHelper>
|
||||
<StyledErrorContainer>
|
||||
{children && isVisible && (
|
||||
<StyledInputErrorHelper aria-live="polite">
|
||||
{children}
|
||||
</StyledInputErrorHelper>
|
||||
)}
|
||||
</StyledErrorContainer>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user