Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fuselage): Vertical Divider #840

Merged
merged 4 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/fuselage/src/components/Divider/Divider.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ComponentStory, ComponentMeta } from '@storybook/react';
import React from 'react';

import { Divider } from '../..';
import { ButtonGroup, Divider, IconButton } from '..';

export default {
title: 'Data Display/Divider',
Expand All @@ -17,3 +17,16 @@ export const WithText: ComponentStory<typeof Divider> = Template.bind({});
WithText.args = {
children: 'Divider',
};

export const Vertical: ComponentStory<typeof Divider> = Template.bind({});
Vertical.args = {
vertical: true,
};

export const AsButtonSeparator = () => (
<ButtonGroup medium>
<IconButton small icon='phone' />
<Divider vertical />
<IconButton small icon='user' />
</ButtonGroup>
);
7 changes: 7 additions & 0 deletions packages/fuselage/src/components/Divider/Divider.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@ $divider-color: theme('divider-color', colors.stroke(extra-light));
margin-block: lengths.margin(8);
padding-inline: lengths.padding(8);
}

&--vertical {
width: 0;
height: lengths.size(20);
margin-block: 0;
margin-inline: lengths.margin(8);
}
}
4 changes: 3 additions & 1 deletion packages/fuselage/src/components/Divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import Box from '../Box';
type DividerProps = ComponentProps<typeof Box> & {
variation?: 'danger';
children?: ReactNode;
vertical?: boolean;
};

const Divider = ({ variation, children, ...props }: DividerProps) => {
const Divider = ({ variation, children, vertical, ...props }: DividerProps) => {
if (!children) {
return (
<Box
is='hr'
rcx-divider
rcx-divider--vertical={vertical}
rcx-divider--danger={variation === 'danger'}
{...props}
/>
Expand Down