-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MenuRenderer, OverflowMenu: add
small
size (#1675)
Co-authored-by: Michael Taranto <[email protected]> Co-authored-by: Michael Taranto <[email protected]>
- Loading branch information
1 parent
0ce0f19
commit 8029534
Showing
24 changed files
with
929 additions
and
144 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,19 @@ | ||
--- | ||
'braid-design-system': minor | ||
--- | ||
|
||
--- | ||
updated: | ||
- MenuRenderer | ||
- OverflowMenu | ||
--- | ||
|
||
**MenuRenderer, OverflowMenu:** Add `small` size. | ||
|
||
Introduce a new `small` size for `MenuRenderer` and `OverflowMenu`. | ||
This is available via the `size` prop, which supports the existing `standard` (default) and `small`. | ||
|
||
**EXAMPLE USAGE:** | ||
```jsx | ||
<MenuRenderer size="small" ... /> | ||
``` |
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
42 changes: 42 additions & 0 deletions
42
packages/braid-design-system/src/lib/components/Badge/defaultBadgeProps.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,42 @@ | ||
import { createContext, useContext, useMemo, type ReactNode } from 'react'; | ||
import type { BadgeProps } from './Badge'; | ||
|
||
interface DefaultBadgeProps { | ||
bleedY: BadgeProps['bleedY']; | ||
} | ||
|
||
const DefaultBadgePropsContext = createContext<DefaultBadgeProps>({ | ||
bleedY: undefined, | ||
}); | ||
|
||
interface DefaultBadgePropsProviderProps extends DefaultBadgeProps { | ||
children: ReactNode; | ||
} | ||
|
||
export const DefaultBadgePropsProvider = ({ | ||
bleedY, | ||
children, | ||
}: DefaultBadgePropsProviderProps) => { | ||
const defaultBadgeProps = useMemo( | ||
() => ({ | ||
bleedY, | ||
}), | ||
[bleedY], | ||
); | ||
|
||
return ( | ||
<DefaultBadgePropsContext.Provider value={defaultBadgeProps}> | ||
{children} | ||
</DefaultBadgePropsContext.Provider> | ||
); | ||
}; | ||
|
||
export const useDefaultBadgeProps = ({ | ||
bleedY: bleedYProp, | ||
}: DefaultBadgeProps) => { | ||
const { bleedY } = useContext(DefaultBadgePropsContext); | ||
|
||
return { | ||
bleedY: bleedYProp ?? bleedY ?? false, | ||
}; | ||
}; |
Oops, something went wrong.