-
Notifications
You must be signed in to change notification settings - Fork 751
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
27bf6cf
commit 67305eb
Showing
8 changed files
with
71 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,44 @@ | ||
import styled, { DefaultTheme } from "styled-components"; | ||
|
||
interface CardProps { | ||
isActive?: boolean; | ||
isSuccess?: boolean; | ||
isWarning?: boolean; | ||
theme: DefaultTheme; | ||
} | ||
|
||
/** | ||
* Priority: Warning --> Success --> Active | ||
*/ | ||
const getBoxShadow = ({ isActive, isSuccess, isWarning, theme }: CardProps) => { | ||
if (isWarning) { | ||
return theme.card.boxShadowWarning; | ||
} | ||
|
||
if (isSuccess) { | ||
return theme.card.boxShadowSuccess; | ||
} | ||
|
||
if (isActive) { | ||
return theme.card.boxShadowActive; | ||
} | ||
|
||
return theme.card.boxShadow; | ||
}; | ||
|
||
const Card = styled.div<CardProps>` | ||
background-color: ${({ theme }) => theme.card.background}; | ||
border: ${({ theme }) => theme.card.boxShadow}; | ||
border-radius: 32px; | ||
box-shadow: ${({ theme }) => theme.shadows.level1}; | ||
box-shadow: ${getBoxShadow}; | ||
color: ${({ theme }) => theme.colors.text}; | ||
padding: 24px; | ||
`; | ||
|
||
Card.defaultProps = { | ||
isActive: false, | ||
isSuccess: false, | ||
isWarning: false, | ||
}; | ||
|
||
export default Card; |
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,11 +1,18 @@ | ||
import shadows from "../../theme/shadows"; | ||
import { CardTheme } from "./types"; | ||
|
||
export const light: CardTheme = { | ||
background: "#FFFFFF", | ||
boxShadow: "1px solid rgba(14, 14, 44, 0.05)", | ||
boxShadow: "0px 2px 12px -8px rgba(25, 19, 38, 0.1), 0px 1px 1px rgba(25, 19, 38, 0.05)", | ||
boxShadowActive: shadows.active, | ||
boxShadowSuccess: shadows.success, | ||
boxShadowWarning: shadows.warning, | ||
}; | ||
|
||
export const dark: CardTheme = { | ||
background: "#2B223E", | ||
boxShadow: "1px solid rgba(14, 14, 44, 0.05)", | ||
boxShadow: "0px 2px 12px -8px rgba(25, 19, 38, 0.1), 0px 1px 1px rgba(25, 19, 38, 0.05)", | ||
boxShadowActive: shadows.active, | ||
boxShadowSuccess: shadows.success, | ||
boxShadowWarning: shadows.warning, | ||
}; |
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,4 +1,7 @@ | ||
export type CardTheme = { | ||
background: string; | ||
boxShadow: string; | ||
boxShadowActive: string; | ||
boxShadowSuccess: string; | ||
boxShadowWarning: string; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const shadows = { | ||
active: "0px 0px 0px 1px #0098A1, 0px 0px 4px 8px rgba(31, 199, 212, 0.4)", | ||
success: "0px 0px 0px 1px #31D0AA, 0px 0px 0px 4px rgba(49, 208, 170, 0.2)", | ||
warning: "0px 0px 0px 1px #ED4B9E, 0px 0px 0px 4px rgba(237, 75, 158, 0.2)", | ||
}; | ||
|
||
export default shadows; |