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: add blockquote #452

Merged
merged 4 commits into from
Sep 18, 2024
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
24 changes: 24 additions & 0 deletions components/Blockquote/Blockquote.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Meta, StoryFn } from '@storybook/react';
import React from 'react';

import { modifyVariantsForStory } from '../../utils/modifyVariantsForStory';
import { Blockquote, BlockquoteProps, BlockquoteVariants } from './Blockquote';

const BaseBlockquote = (props: BlockquoteProps): JSX.Element => <Blockquote {...props} />;

const BlockquoteForStory = modifyVariantsForStory<BlockquoteVariants, BlockquoteProps>(
BaseBlockquote,
);

const Component: Meta<typeof BlockquoteForStory> = {
title: 'Components/Blockquote',
component: BlockquoteForStory,
};

const Template: StoryFn<typeof BlockquoteForStory> = (args) => (
<Blockquote {...args}>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</Blockquote>
);

export const Basic: StoryFn<typeof BlockquoteForStory> = Template.bind({});

export default Component;
10 changes: 10 additions & 0 deletions components/Blockquote/Blockquote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { CSS, styled, VariantProps } from '../../stitches.config';
import { Text } from '../Text';

export const Blockquote = styled(Text, {
borderLeft: '2px solid $textDefault',
p: '$2 $3',
});

export type BlockquoteVariants = VariantProps<typeof Blockquote>;
export type BlockquoteProps = BlockquoteVariants & { css?: CSS };
1 change: 1 addition & 0 deletions components/Blockquote/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Blockquote';
21 changes: 21 additions & 0 deletions components/List/List.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ const Template: StoryFn<typeof Ul> = (args) => (

export const Basic: StoryFn<typeof Ul> = Template.bind({});

export const Checkboxes: StoryFn<typeof Ul> = (args) => (
<Ul {...args}>
<Li>
<input type="checkbox" disabled />
Dashboard
</Li>
<Li>
<input type="checkbox" disabled />
Profile
</Li>
<Li>
<input type="checkbox" disabled />
Settings
</Li>
<Li>
<input type="checkbox" disabled />
Help
</Li>
</Ul>
);

export const Ordered: StoryFn<typeof Ol> = (args) => (
<Ol {...args}>
<Li>Dashboard</Li>
Expand Down
25 changes: 19 additions & 6 deletions components/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const StyledSpan = styled('span', Flex, {
...LIST_ITEM_CONTENT_STYLES,
// CUSTOM
p: '$1',
gap: '$1',
});

const StyledListItemButton = styled('button', Flex, {
Expand Down Expand Up @@ -86,19 +87,31 @@ const StyledLi = styled('li', {
});

const StyledUl = styled('ul', {
m: 0,
m: '0 0 0 8px',
p: 0,
color: '$hiContrast',
color: '$textDefault',

'&:has(li > span > input[type="checkbox"])': {
m: 0,
listStyle: 'none',
li: {
marginLeft: 0,
span: {
input: {
margin: '0 3px 0 0',
},
},
},
},
});

const StyledOl = styled('ol', {
m: 0,
m: '0 0 0 8px',
p: 0,
color: '$hiContrast',
color: '$textDefault',

'> li::marker': {
fontSize: '$3',
color: '$hiContrast',
fontFamily: '$rubik',
},
});
Expand Down Expand Up @@ -175,7 +188,7 @@ export const Li = React.forwardRef<React.ElementRef<typeof StyledLi>, ListItemPr
</StyledListItemButton>
) : (
<StyledSpan
align={align}
align={align || 'center'}
justify={justify}
direction={direction}
gap={gap}
Expand Down
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export {
} from './components/AriaTable';
export { Avatar } from './components/Avatar';
export { Badge } from './components/Badge';
export { Blockquote } from './components/Blockquote';
export { Box } from './components/Box';
export { Bubble } from './components/Bubble';
export { Button } from './components/Button';
Expand Down