-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Luiz Estácio | stacio.eth <luizstacio@gmail.com>
- Loading branch information
1 parent
2d084de
commit 81a5d93
Showing
17 changed files
with
1,693 additions
and
1,591 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
import { getTsconfig } from 'get-tsconfig'; | ||
import { relative } from 'node:path'; | ||
|
||
export default { | ||
'**/*.(md|mdx|json|html|css)': ['prettier --write'], | ||
'**/*.(t|j)s?(x)': ['prettier --write', 'eslint'], | ||
'**/*.ts?(x)': (files) => { | ||
const commands = files.map((file) => { | ||
const tsConfig = relative(process.cwd(), getTsconfig(file).path); | ||
return `tsc -p ${tsConfig} --noEmit`; | ||
}); | ||
return Array.from(new Set(commands)); | ||
}, | ||
}; |
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
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 |
---|---|---|
@@ -1,11 +1,34 @@ | ||
import { Badge as RadixBadge } from '@radix-ui/themes'; | ||
|
||
import { useIconProps } from '../../hooks/useIconProps'; | ||
import type { WithIconProps } from '../../hooks/useIconProps'; | ||
import { useVariants } from '../../hooks/useVariants'; | ||
import type { WithVariants } from '../../hooks/useVariants'; | ||
import { createComponent } from '../../utils/component'; | ||
import type { PropsOf } from '../../utils/types'; | ||
|
||
export type BadgeProps = PropsOf<typeof RadixBadge>; | ||
export type BadgeBaseProps = PropsOf<typeof RadixBadge>; | ||
export type BadgeVariants = 'solid' | 'ghost' | 'surface' | 'outline'; | ||
export type BadgeProps = WithVariants<BadgeBaseProps, BadgeVariants> & | ||
WithIconProps; | ||
|
||
export const Badge = createComponent<BadgeProps, typeof RadixBadge>({ | ||
export const Badge = createComponent<BadgeProps, 'span'>({ | ||
id: 'Badge', | ||
baseElement: RadixBadge, | ||
render: (_, props) => { | ||
const { disabled, ...itemProps } = useIconProps(props); | ||
const variantProps = useVariants<BadgeProps, BadgeVariants>(props); | ||
return ( | ||
<RadixBadge | ||
{...(itemProps as BadgeBaseProps)} | ||
{...(variantProps as BadgeBaseProps)} | ||
{...(disabled && { | ||
disabled, | ||
'aria-disabled': disabled, | ||
})} | ||
/> | ||
); | ||
}, | ||
defaultProps: { | ||
size: '1', | ||
}, | ||
}); |
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
Oops, something went wrong.