-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #545 from Atom-Learning/DS-406-👩🏻💻-spike-badges-u…
…se-color-scheme Badge: New emphasis, themes and overflow truncation features
- Loading branch information
Showing
19 changed files
with
1,529 additions
and
216 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as React from 'react' | ||
|
||
import type { TBadgeProps } from './Badge' | ||
|
||
type TBadgeProviderProps = { | ||
size?: TBadgeProps['size'] | ||
overflow?: TBadgeProps['overflow'] | ||
} | ||
|
||
type TBadgeContext = TBadgeProviderProps & { | ||
isOverflowing?: boolean | ||
setIsOverflowing?: React.Dispatch<React.SetStateAction<boolean>> | ||
} | ||
|
||
export const BadgeContext = React.createContext<TBadgeContext>({}) | ||
|
||
export const BadgeProvider = ({ | ||
size, | ||
overflow, | ||
children | ||
}: React.PropsWithChildren<TBadgeProviderProps>) => { | ||
const [isOverflowing, setIsOverflowing] = React.useState(false) | ||
|
||
const value = React.useMemo<TBadgeContext>( | ||
() => ({ size, overflow, isOverflowing, setIsOverflowing }), | ||
[size, overflow, isOverflowing, setIsOverflowing] | ||
) | ||
return <BadgeContext.Provider value={value}>{children}</BadgeContext.Provider> | ||
} |
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.