Skip to content
Snippets Groups Projects
Unverified Commit 77502f47 authored by Ariya Hidayat's avatar Ariya Hidayat Committed by GitHub
Browse files

Fix toggle button alignment (#22464)

parent b1a37f38
No related branches found
No related tags found
No related merge requests found
......@@ -76,6 +76,7 @@ function FormField(props) {
};
const formFieldId = `formField-${name.replace(ALL_DOT_CHARS, "-")}`;
const isToggle = formField?.type === "boolean";
if (!visited || active) {
// if the field hasn't been visited or is currently active then don't show the error
......@@ -98,6 +99,7 @@ function FormField(props) {
id={`${name}-label`}
htmlFor={name}
horizontal={horizontal}
standAlone={isToggle && align === "right" && !description}
>
{title}
{error && <span className="text-error">: {error}</span>}
......
......@@ -17,6 +17,11 @@ export const Label = styled.label`
css`
margin-right: auto;
`}
${props =>
props.standAlone &&
css`
margin-top: 0.8em;
`}
`;
Label.defaultProps = { className: "Form-label" };
......@@ -38,6 +43,7 @@ export const InfoLabel = styled.span`
`;
export const FieldContainer = styled.div`
width: 100%;
margin-right: ${props => (props.horizontal ? "1rem" : "")};
margin-left: ${props => (props.align === "left" ? "0.5rem" : "")};
`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment