-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f865f6c
commit 16e0adf
Showing
58 changed files
with
3,666 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { ReactNode } from "react"; | ||
import styles from "./theme.module.css"; | ||
|
||
export const ThemeProvider = <Theme,>({ | ||
children, | ||
theme, | ||
}: { | ||
children?: ReactNode; | ||
theme?: Theme; | ||
}) => { | ||
return ( | ||
<div className={styles.theme} data-theme={theme}> | ||
{children} | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.theme[data-theme] { | ||
background: var(--theme-background-subtle); | ||
} |
Binary file not shown.
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,4 +1,6 @@ | ||
.avatar { | ||
flex-grow: 0; | ||
flex-shrink: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
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,34 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { fn } from '@storybook/test'; | ||
|
||
import { Badge } from './Badge'; | ||
|
||
const meta = { | ||
title: 'Atoms/Badge/Badge', | ||
component: Badge, | ||
tags: ['autodocs'], | ||
parameters: {}, | ||
args: { | ||
label: 'Badge', | ||
}, | ||
} satisfies Meta<typeof Badge>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; | ||
|
||
export const Alert: Story = { | ||
args: { | ||
color: 'alert', | ||
}, | ||
}; | ||
|
||
export const UnreadCount: Story = { | ||
args: { | ||
label: '2', | ||
color: 'alert', | ||
}, | ||
}; |
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,19 +1,82 @@ | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
import cx from 'classnames'; | ||
import type { ReactNode } from 'react'; | ||
import styles from './badge.module.css'; | ||
======= | ||
import cx from "classnames"; | ||
import styles from "./badge.module.css"; | ||
import type { ReactNode } from "react"; | ||
|
||
export type BadgeColor = "subtle" | "alert"; | ||
export type BadgeSize = "sm"; | ||
>>>>>>> 5a289ef (badge fixes restored) | ||
|
||
======= | ||
import cx from "classnames"; | ||
import styles from "./badge.module.css"; | ||
import type { ReactNode } from "react"; | ||
======= | ||
import cx from 'classnames'; | ||
import type { ReactNode } from 'react'; | ||
import styles from './badge.module.css'; | ||
>>>>>>> 058ad14 (list + dialogs) | ||
|
||
export type BadgeColor = 'subtle' | 'alert'; | ||
export type BadgeSize = 'sm'; | ||
|
||
>>>>>>> 1b23eba (push it) | ||
======= | ||
import cx from "classnames"; | ||
import styles from "./badge.module.css"; | ||
import type { ReactNode } from "react"; | ||
======= | ||
import cx from 'classnames'; | ||
import type { ReactNode } from 'react'; | ||
import styles from './badge.module.css'; | ||
>>>>>>> 722d2dc (badge biome fix) | ||
|
||
export type BadgeColor = 'subtle' | 'alert'; | ||
export type BadgeSize = 'sm'; | ||
|
||
>>>>>>> 5364fc1 (badge fixes) | ||
export interface BadgeProps { | ||
label?: string | number; | ||
variant?: 'neutral' | 'strong'; | ||
size?: 'medium' | 'small'; | ||
color?: BadgeColor; | ||
size?: BadgeSize; | ||
className?: string; | ||
children?: ReactNode; | ||
} | ||
|
||
// TODO: add aria-label to the badge | ||
export const Badge = ({ label, variant = 'neutral', size = 'medium', children }: BadgeProps) => { | ||
const classNames = cx(styles.badge, { | ||
[styles.strong]: variant === 'strong', | ||
[styles.small]: size === 'small', | ||
}); | ||
return <span className={classNames}>{label || children}</span>; | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
export const Badge = ({ label, color = 'subtle', size = 'sm', className, children }: BadgeProps) => { | ||
return ( | ||
<span className={cx(styles.badge, className)} data-color={color} data-size={size}> | ||
======= | ||
export const Badge = ({ | ||
label, | ||
color = "subtle", | ||
size = "sm", | ||
className, | ||
children, | ||
}: BadgeProps) => { | ||
return ( | ||
<span | ||
className={cx(styles.badge, className)} | ||
data-color={color} | ||
data-size={size} | ||
> | ||
>>>>>>> 5a289ef (badge fixes restored) | ||
======= | ||
export const Badge = ({ label, color = 'subtle', size = 'sm', className, children }: BadgeProps) => { | ||
return ( | ||
<span className={cx(styles.badge, className)} data-color={color} data-size={size}> | ||
>>>>>>> 722d2dc (badge biome fix) | ||
<span className={styles.label}>{label || children}</span> | ||
</span> | ||
); | ||
}; |
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,36 +1,27 @@ | ||
.badge { | ||
display: inline-flex; | ||
box-sizing: border-box; | ||
padding: 4px 8px; | ||
justify-content: center; | ||
min-height: 24px; | ||
min-width: 24px; | ||
width: auto; | ||
height: 24px; | ||
align-items: center; | ||
flex-shrink: 0; | ||
background: var(--black-5, rgba(0, 0, 0, 0.05)); | ||
color: var(--black-100, #000); | ||
justify-content: center; | ||
white-space: nowrap; | ||
|
||
font-weight: 500; | ||
line-height: 1; | ||
padding: 0.5em 0.5em; | ||
|
||
min-width: 2em; | ||
border-radius: 2em; | ||
} | ||
|
||
.badge[data-size="sm"] { | ||
font-size: 0.75rem; | ||
font-weight: 600; | ||
line-height: 1rem; | ||
border-radius: 12px; | ||
} | ||
|
||
.strong { | ||
font-weight: 700; | ||
background: var(--Action-Important, #e02e49); | ||
color: #ffffff; | ||
.badge[data-color="subtle"] { | ||
background-color: var(--theme-surface-default); | ||
color: var(--theme-text-subtle); | ||
} | ||
|
||
.small { | ||
display: flex; | ||
width: 12px; | ||
height: 12px; | ||
min-height: 12px; | ||
min-width: 12px; | ||
padding: 4px; | ||
justify-content: center; | ||
align-items: center; | ||
flex-shrink: 0; | ||
.badge[data-color="alert"] { | ||
background-color: #e02e49; | ||
color: white; | ||
} |
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.