forked from woowacourse-teams/2024-code-zap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInput.style.ts
139 lines (112 loc) · 2.13 KB
/
Input.style.ts
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import type { BaseProps, TextFieldProps } from './Input';
const sizes = {
small: css`
gap: 0.5rem;
height: 2rem;
padding: 0 0.75rem;
font-size: 0.75rem;
line-height: 100%;
border-radius: 8px;
`,
medium: css`
gap: 0.875rem;
height: 2.5rem;
padding: 0 0.875rem;
font-size: 0.875rem;
line-height: 100%;
border-radius: 10px;
`,
large: css`
gap: 0.75rem;
height: 3rem;
padding: 0 1rem;
font-size: 1rem;
line-height: 100%;
border-radius: 12px;
`,
xlarge: css`
gap: 0.75rem;
height: 4rem;
padding: 1rem;
font-size: 2rem;
line-height: 100%;
border-radius: 12px;
`,
};
const variants = {
filled: css`
background-color: #ffffff;
`,
outlined: css`
background: none;
border: 1px solid #808080;
`,
text: css`
background: none;
`,
};
export const Container = styled.div`
display: flex;
flex-direction: column;
gap: 0.5rem;
width: 100%;
`;
export const Base = styled.div<BaseProps>`
display: flex;
align-items: center;
${({ variant }) => variant && variants[variant]};
${({ size }) => size && sizes[size]};
${({ isValid }) =>
isValid === false &&
css`
border: 1px solid red;
`};
/* for Adornment size */
& > div {
${({ size }) =>
size === 'small' &&
css`
width: 0.75rem;
height: 0.75rem;
`}
${({ size }) =>
size === 'medium' &&
css`
width: 1rem;
height: 1rem;
`}
}
`;
export const TextField = styled.input<TextFieldProps>`
width: 100%;
font-size: inherit;
line-height: inherit;
background: none;
&::placeholder {
color: #788496;
}
&:focus {
outline: none;
}
&:disabled {
cursor: default;
opacity: 0.6;
background: none;
border-color: #ddd;
}
`;
export const Label = styled.label`
font-size: 1rem;
line-height: 100%;
`;
export const Adornment = styled.div`
display: flex;
`;
export const HelperText = styled.span`
height: 1rem;
margin-left: 0.5rem;
font-size: 1rem;
color: red;
`;