Skip to content

Commit

Permalink
update Divider (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
robphoenix authored Jul 11, 2024
1 parent 32dabfa commit 40c0625
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/orange-rivers-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@utilitywarehouse/web-ui': patch
---

Update `Divider` component & docs
12 changes: 12 additions & 0 deletions packages/web-ui/src/Divider/Divider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Heading } from '../Heading';
import { Text } from '../Text';
import { Strong } from '../Strong';
import { colors } from '@utilitywarehouse/colour-system';
import { Box } from '../Box';

const meta: Meta<typeof Divider> = {
title: 'Web UI / Components / Divider',
Expand Down Expand Up @@ -83,3 +84,14 @@ export const CustomColor: Story = {
);
},
};

export const UsageOutsideFlexbox: Story = {
render: () => (
<Box width="100%" p={4}>
<Divider decorative />
<Box height={100}>
<Divider orientation="vertical" decorative />
</Box>
</Box>
),
};
4 changes: 3 additions & 1 deletion packages/web-ui/src/Divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const StyledElement = styled('hr', {
})<{ color: string }>(({ color }) => {
return {
all: 'unset',
display: 'block', // explicitly set this so horizontal dividers show inside block elements
alignSelf: 'stretch',
flexShrink: 0,
backgroundColor: color,
Expand All @@ -34,7 +35,8 @@ const StyledElement = styled('hr', {

/**
* Used to provide a visual break and semantically divide content. Supports
* vertical and horizontal orientations.
* vertical and horizontal orientations. Vertical dividers will only be visible
* when contained inside an element with display set to `flexbox` or `grid`.
*/
export const Divider = React.forwardRef<React.ElementRef<'hr'>, DividerProps>(
(
Expand Down

0 comments on commit 40c0625

Please sign in to comment.