-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.tsx
51 lines (44 loc) · 1.72 KB
/
Card.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { styled } from 'styled-components';
import { transitionName } from '../helpers/transitionName';
type CardProps = {
/** Adds a colorful border */
highlight?: boolean;
/** Sets a maximum height */
small?: boolean;
};
/** A Card with a border. */
export const Card = styled.div<CardProps>`
background-color: ${props => props.theme.colors.bg};
/** Don't put side margins in this component - use a wrapping component */
border: solid 1px ${props => props.theme.colors.bg2};
box-shadow: ${props => props.theme.boxShadow};
padding: ${props => props.theme.margin}rem;
/* margin-bottom: ${props => props.theme.margin}rem; */
padding-bottom: 0;
border-radius: ${props => props.theme.radius};
max-height: ${props => (props.small ? '10rem' : 'none')};
overflow: ${props => (props.small ? 'hidden' : 'visible')};
border-color: ${props =>
props.highlight ? props.theme.colors.main : props.theme.colors.bg2};
${p => transitionName('resource-page', p.about)};
`;
export interface CardRowProps {
noBorder?: boolean;
}
/** A Row in a Card. Should probably be used inside a CardInsideFull */
export const CardRow = styled.div<CardRowProps>`
--border: solid 1px ${props => props.theme.colors.bg2};
display: block;
border-top: ${props => (props.noBorder ? 'none' : 'var(--border)')};
padding: ${props => props.theme.margin / 3}rem
${props => props.theme.margin}rem;
`;
/** A block inside a Card which has full width */
export const CardInsideFull = styled.div`
margin-left: -${props => props.theme.margin}rem;
margin-right: -${props => props.theme.margin}rem;
`;
export const Margin = styled.div`
display: block;
height: ${props => props.theme.margin}rem;
`;