-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore!: make CardAction a react component (#1710)
- Loading branch information
1 parent
58a7569
commit adbe237
Showing
6 changed files
with
43 additions
and
30 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': major | ||
--- | ||
|
||
chore!: CardAction is now a react component |
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 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,36 @@ | ||
import { styled } from 'styled-components'; | ||
|
||
import { PropsToTransientProps } from '../../types'; | ||
import { Flex, FlexComponent, FlexProps } from '../Flex'; | ||
|
||
type CardActionPosition = 'end' | 'start'; | ||
|
||
type CardActionProps = Omit<FlexProps<'div'>, 'direction' | 'gap' | 'position'> & { | ||
position: CardActionPosition; | ||
}; | ||
|
||
const CardActionImpl = ({ position, ...restProps }: CardActionProps) => { | ||
return <CardAction $position={position} {...restProps} direction="row" gap={2} />; | ||
}; | ||
|
||
const CardAction = styled<FlexComponent>(Flex)<PropsToTransientProps<CardActionProps>>` | ||
position: absolute; | ||
top: ${({ theme }) => theme.spaces[3]}; | ||
right: ${({ $position, theme }) => { | ||
if ($position === 'end') { | ||
return theme.spaces[3]; | ||
} | ||
return undefined; | ||
}}; | ||
left: ${({ $position, theme }) => { | ||
if ($position === 'start') { | ||
return theme.spaces[3]; | ||
} | ||
return undefined; | ||
}}; | ||
`; | ||
|
||
export { CardActionImpl as CardAction }; | ||
export type { CardActionProps, CardActionPosition }; |
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