-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into changeset-release/main
- Loading branch information
Showing
15 changed files
with
401 additions
and
368 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,5 @@ | ||
--- | ||
'@strapi/design-system': minor | ||
--- | ||
|
||
chore: standardise forwardRefs across components |
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
28 changes: 16 additions & 12 deletions
28
packages/design-system/src/components/Breadcrumbs/Crumb.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 |
---|---|---|
@@ -1,22 +1,26 @@ | ||
import * as React from 'react'; | ||
|
||
import { Box } from '../Box'; | ||
import { Typography, TypographyProps } from '../Typography'; | ||
|
||
export interface CrumbProps extends TypographyProps { | ||
isCurrent?: boolean; | ||
} | ||
|
||
export const Crumb = ({ children, isCurrent = false, ...props }: CrumbProps) => ( | ||
<Box paddingLeft={2} paddingRight={2} paddingTop={1} paddingBottom={1}> | ||
<Typography | ||
variant="pi" | ||
textColor="neutral800" | ||
fontWeight={isCurrent ? 'bold' : 'regular'} | ||
aria-current={isCurrent} | ||
{...props} | ||
> | ||
{children} | ||
</Typography> | ||
</Box> | ||
export const Crumb = React.forwardRef<HTMLDivElement, CrumbProps>( | ||
({ children, isCurrent = false, ...props }, forwardedRef) => ( | ||
<Box paddingLeft={2} paddingRight={2} paddingTop={1} paddingBottom={1} ref={forwardedRef}> | ||
<Typography | ||
variant="pi" | ||
textColor="neutral800" | ||
fontWeight={isCurrent ? 'bold' : 'regular'} | ||
aria-current={isCurrent} | ||
{...props} | ||
> | ||
{children} | ||
</Typography> | ||
</Box> | ||
), | ||
); | ||
|
||
Crumb.displayName = 'Crumb'; |
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,19 +1,21 @@ | ||
import * as React from 'react'; | ||
|
||
import { Checkbox, CheckboxProps } from '../Checkbox'; | ||
|
||
import { CardAction } from './CardAction'; | ||
import { useCard } from './CardContext'; | ||
|
||
interface CardCheckboxProps extends CheckboxProps {} | ||
|
||
const CardCheckbox = (props: CardCheckboxProps) => { | ||
const CardCheckbox = React.forwardRef<HTMLButtonElement, CardCheckboxProps>((props, forwardedRef) => { | ||
const { id } = useCard(); | ||
|
||
return ( | ||
<CardAction position="start"> | ||
<Checkbox aria-labelledby={`${id}-title`} {...props} /> | ||
<Checkbox aria-labelledby={`${id}-title`} {...props} ref={forwardedRef} /> | ||
</CardAction> | ||
); | ||
}; | ||
}); | ||
|
||
export { CardCheckbox }; | ||
export type { CardCheckboxProps }; |
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.