Skip to content

Commit

Permalink
Added fieldset and updated styling
Browse files Browse the repository at this point in the history
  • Loading branch information
louwie17 committed Oct 1, 2024
1 parent 5e27cff commit 68546cd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function DataFormCombinedEdit< Item >( {
return (
<>
{ ! hideLabelFromVision && <Header title={ field.label } /> }
<Stack spacing={ 4 } className={ className }>
<Stack spacing={ 4 } className={ className } as="fieldset">
{ children }
</Stack>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
.dataforms-layouts-panel__field-dropdown {
.dataforms-combined-edit {
border: none;
padding: 0;

&__field:not(:first-child) {
border-top: $border-width solid $gray-200;
padding-top: $grid-unit-20;
}
}
}

.dataforms-combined-edit {
&__field {
flex: 1 1 auto;
}
}
24 changes: 22 additions & 2 deletions packages/dataviews/src/components/dataform/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ export const Default = ( { type }: { type: 'panel' | 'regular' } ) => {
);
};

export const CombinedFields = ( { type }: { type: 'panel' | 'regular' } ) => {
const CombinedFieldsComponent = ( {
type = 'regular',
combinedFieldDirection = 'vertical',
}: {
type: 'panel' | 'regular';
combinedFieldDirection: 'vertical' | 'horizontal';
} ) => {
const [ post, setPost ] = useState( {
title: 'Hello, World!',
order: 2,
Expand All @@ -140,7 +146,7 @@ export const CombinedFields = ( { type }: { type: 'panel' | 'regular' } ) => {
id: 'status_and_visibility',
label: 'Status & Visibility',
children: [ 'status', 'password' ],
direction: 'vertical',
direction: combinedFieldDirection,
render: ( { item } ) => item.status,
},
] as CombinedFormField< any >[],
Expand All @@ -163,3 +169,17 @@ export const CombinedFields = ( { type }: { type: 'panel' | 'regular' } ) => {
/>
);
};

export const CombinedFields = {
title: 'DataViews/CombinedFields',
render: CombinedFieldsComponent,
argTypes: {
...meta.argTypes,
combinedFieldDirection: {
control: { type: 'select' },
description:
'Chooses the direction of the combined field. "vertical" is the default layout.',
options: [ 'vertical', 'horizontal' ],
},
},
};

0 comments on commit 68546cd

Please sign in to comment.