-
Notifications
You must be signed in to change notification settings - Fork 4
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
3164a83
commit 7f0faf9
Showing
3 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
13 changes: 10 additions & 3 deletions
13
src/components/surfaces/Card/CardActions/CardActionsStyles.ts
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,20 +1,27 @@ | ||
import { Theme } from '@mui/material' | ||
import MuiCardActions from '@mui/material/CardActions' | ||
import { styled } from '@mui/material/styles' | ||
import { includes } from 'ramda' | ||
import { T, always, cond, equals, includes } from 'ramda' | ||
import { ActionAlign } from '../types' | ||
|
||
type StyledProps = { theme: Theme; filled: boolean; align: ActionAlign } | ||
|
||
const contentAlignment = cond([ | ||
[equals('left'), always('flex-start')], | ||
[equals('right'), always('flex-end')], | ||
[equals('center'), always('center')], | ||
[T, always('flex-start')] | ||
]) | ||
|
||
const CardActions = styled(MuiCardActions, { | ||
shouldForwardProp: prop => !includes(prop, ['align', 'filled']) | ||
})(({ theme, filled, align = 'left' }: Partial<StyledProps>) => ({ | ||
})(({ theme, filled, align }: Partial<StyledProps>) => ({ | ||
...(filled && { | ||
backgroundColor: theme?.palette.grey[200], | ||
minHeight: '48px', | ||
padding: theme?.spacing(2, 3) | ||
}), | ||
justifyContent: align === 'left' ? 'flex-start' : 'flex-end' | ||
justifyContent: contentAlignment(align) | ||
})) | ||
|
||
export default CardActions |
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