Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 356x 1x 4274x 1x 4272x | import { ChangeEvent, ReactElement } from "react";
import styled from "styled-components";
interface Props {
checked: boolean;
id: string;
name?: string;
label: string;
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
}
export const RadioButton = ({
checked,
id,
label,
name,
onChange,
}: Props): ReactElement => {
return (
<StyledLabel htmlFor={id}>
<StyledRadioButton
checked={checked}
onChange={onChange}
type="radio"
id={id}
name={name}
/>
{label}
</StyledLabel>
);
};
const StyledLabel = styled.label`
font-size: ${(props) => props.theme.fontSizeNormal};
`;
const StyledRadioButton = styled.input`
accent-color: ${(props) => props.theme.formAccent};
transform: scale(1.5);
margin-right: 8px;
`;
|