Skip to content

Commit 6d56d10

Browse files
committed
feat(generators): add modal templates to components generator
1 parent daf3202 commit 6d56d10

4 files changed

Lines changed: 40 additions & 0 deletions

File tree

generators/components/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const generator = (plop: NodePlopAPI): void => {
1111
name: 'type',
1212
message: 'Select component type:',
1313
choices: [
14+
{ name: 'Modal', value: 'modal' },
1415
{ name: 'Popover', value: 'popover' },
1516
{ name: 'Tooltip', value: 'tooltip' },
1617
],
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { ModalProps } from '@atls-ui-parts/modal'
2+
import type { ReactElement } from 'react'
3+
4+
import { Modal as BaseModal } from '@atls-ui-parts/modal'
5+
6+
import { backdropStyles } from './styles.css.js'
7+
import { containerStyles } from './styles.css.js'
8+
9+
export const Modal = ({ children, ...props }: ModalProps): ReactElement => (
10+
<BaseModal backdropProps={{ className: backdropStyles }} {...props}>
11+
<div className={containerStyles}>{children}</div>
12+
</BaseModal>
13+
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './component.js'
2+
export type { ModalProps } from '@atls-ui-parts/modal'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { style } from '@vanilla-extract/css'
2+
import { keyframes } from '@vanilla-extract/css'
3+
4+
const fadeIn = keyframes({
5+
from: {
6+
opacity: 0,
7+
},
8+
to: {
9+
opacity: 1,
10+
},
11+
})
12+
13+
export const backdropStyles = style({
14+
display: 'grid',
15+
placeItems: 'center',
16+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
17+
animation: `${fadeIn} 0.2s ease-out`,
18+
zIndex: 1,
19+
})
20+
21+
export const containerStyles = style({
22+
padding: '40px',
23+
background: '#ffffff',
24+
})

0 commit comments

Comments
 (0)