Skip to content

Commit

Permalink
fix: Clean up styles
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel.carrera committed Sep 18, 2024
1 parent 23e2f63 commit 521f102
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 21 deletions.
1 change: 0 additions & 1 deletion modules/preview-react/form-field/lib/FormFieldHint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const formFieldHintStencil = createStencil({
extends: textStencil,
base: {
margin: `${system.space.x2} ${system.space.zero} ${system.space.zero}`,

[parentModifier(formFieldStencil.modifiers.error.error)]: {
color: brand.error.base,
},
Expand Down
4 changes: 2 additions & 2 deletions modules/preview-react/form-field/lib/FormFieldInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import {createSubcomponent, ExtractProps} from '@workday/canvas-kit-react/common';
import {Box} from '@workday/canvas-kit-react/layout';
import {Box, mergeStyles} from '@workday/canvas-kit-react/layout';

import {useFormFieldInput, useFormFieldModel} from './hooks';

Expand All @@ -10,5 +10,5 @@ export const FormFieldInput = createSubcomponent('input')({
modelHook: useFormFieldModel,
elemPropsHook: useFormFieldInput,
})<ExtractProps<typeof Box, never>>((elemProps, Element) => {
return <Box data-width="ck-formfield-width" as={Element} {...elemProps} />;
return <Box data-width="ck-formfield-width" as={Element} {...mergeStyles(elemProps)} />;
});
3 changes: 3 additions & 0 deletions modules/preview-react/form-field/lib/formFieldStencil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export const formFieldStencil = createStencil({
'[data-width="ck-formfield-width"]': {
width: '100%',
},
'&:has(div[data-width="ck-formfield-width"])': {
width: '100%',
},
},
},
orientation: {
Expand Down
20 changes: 6 additions & 14 deletions modules/react/checkbox/stories/examples/Inverse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {Checkbox} from '@workday/canvas-kit-react/checkbox';
import {Flex} from '@workday/canvas-kit-react/layout';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
import {FormField} from '@workday/canvas-kit-preview-react/form-field';

const styleOverrides = createStyles({
gap: system.space.x4,
backgroundColor: system.color.bg.primary.default,
padding: system.space.x4,
});
Expand All @@ -20,18 +18,12 @@ export const Inverse = () => {

return (
<Flex cs={styleOverrides}>
<FormField>
<FormField.Label>Confirm</FormField.Label>
<FormField.Field>
<FormField.Input
as={Checkbox}
variant="inverse"
checked={checked}
label="I agree to the terms"
onChange={handleChange}
/>
</FormField.Field>
</FormField>
<Checkbox
variant="inverse"
checked={checked}
label="I agree to the terms"
onChange={handleChange}
/>
</Flex>
);
};
4 changes: 2 additions & 2 deletions modules/react/text-area/stories/examples/Grow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export const Grow = () => {

return (
<FormField>
<FormField.Label>Leave a Review</FormField.Label>
<FormField.Label>Leave a Review foo</FormField.Label>
<FormField.Field>
<FormField.Input as={TextArea} grow onChange={handleChange} value={value} />
<FormField.Input as={TextArea} onChange={handleChange} value={value} />
</FormField.Field>
</FormField>
);
Expand Down
4 changes: 2 additions & 2 deletions modules/react/text-input/stories/examples/Grow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export const Grow = () => {
};

return (
<FormField width="100%">
<FormField grow>
<FormField.Label>Street Address</FormField.Label>
<FormField.Field>
<FormField.Input width="100%" as={TextInput} onChange={handleChange} value={value} />
<FormField.Input as={TextInput} onChange={handleChange} value={value} />
</FormField.Field>
</FormField>
);
Expand Down

0 comments on commit 521f102

Please sign in to comment.