-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pr fixes and adds modal footer
- Loading branch information
Showing
13 changed files
with
136 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/lsd-react/src/components/ModalFooter/ModalFooter.classes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const modalFooterClasses = { | ||
root: `lsd-modal-footer`, | ||
} |
48 changes: 48 additions & 0 deletions
48
packages/lsd-react/src/components/ModalFooter/ModalFooter.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Meta, Story } from '@storybook/react' | ||
import { ModalFooter, ModalFooterProps } from './ModalFooter' | ||
import { Button } from '../Button' | ||
|
||
export default { | ||
title: 'ModalFooter', | ||
component: ModalFooter, | ||
argTypes: { | ||
size: { | ||
type: { | ||
name: 'enum', | ||
value: ['xsmall', 'small', 'medium', 'large'], | ||
}, | ||
}, | ||
}, | ||
} as Meta | ||
|
||
export const Root: Story< | ||
ModalFooterProps & { | ||
size: 'xsmall' | 'small' | 'medium' | 'large' | ||
} | ||
> = ({ size, ...args }) => { | ||
const footerStyle: React.CSSProperties = { | ||
boxSizing: 'border-box', | ||
border: '1px solid rgb(var(--lsd-border-primary)', | ||
padding: '30px', | ||
} | ||
|
||
return ( | ||
<ModalFooter {...args} style={footerStyle}> | ||
<ModalFooter> | ||
<Button | ||
size={size === 'xsmall' ? 'small' : size} | ||
style={{ | ||
marginRight: 12, | ||
}} | ||
> | ||
Button 1 | ||
</Button> | ||
<Button size={size === 'xsmall' ? 'small' : size}>Button 2</Button> | ||
</ModalFooter> | ||
</ModalFooter> | ||
) | ||
} | ||
|
||
Root.args = { | ||
size: 'large', | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/lsd-react/src/components/ModalFooter/ModalFooter.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { css } from '@emotion/react' | ||
import { modalFooterClasses } from './ModalFooter.classes' | ||
|
||
export const ModalFooterStyles = css` | ||
.${modalFooterClasses.root} { | ||
display: flex; | ||
} | ||
` |
28 changes: 28 additions & 0 deletions
28
packages/lsd-react/src/components/ModalFooter/ModalFooter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import clsx from 'clsx' | ||
import React from 'react' | ||
import { | ||
CommonProps, | ||
omitCommonProps, | ||
useCommonProps, | ||
} from '../../utils/useCommonProps' | ||
import { modalFooterClasses } from './ModalFooter.classes' | ||
|
||
export type ModalFooterProps = CommonProps & | ||
Omit<React.HTMLAttributes<HTMLDivElement>, 'label'> | ||
|
||
export const ModalFooter: React.FC<ModalFooterProps> & { | ||
classes: typeof modalFooterClasses | ||
} = ({ children, ...props }) => { | ||
const commonProps = useCommonProps(props) | ||
|
||
return ( | ||
<div | ||
{...omitCommonProps(props)} | ||
className={clsx(commonProps.className, modalFooterClasses.root)} | ||
> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
ModalFooter.classes = modalFooterClasses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './ModalFooter' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters