Skip to content

Commit bede0ee

Browse files
committed
fancy select
1 parent afad142 commit bede0ee

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

packages/app/src/app/pages/common/Modals/ShareModal2/elements.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ export const Input = styled.input<{ code?: boolean }>(({ code }) =>
105105
width: '100%',
106106
boxSizing: 'border-box', // probably not right
107107
height: 32,
108-
lineHeight: '32px',
109108

110109
fontFamily: code ? 'code' : 'body',
111110

@@ -136,6 +135,22 @@ export const TextArea = styled(Input).attrs({ as: 'textarea' })(
136135
StyledComponentInnerOtherProps<typeof Input>
137136
>;
138137

138+
const caret =
139+
'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMTAgMjQiIHdpZHRoPSIxMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjNzU3NTc1Ij48cGF0aCBkPSJtNS4wMDAwNiAxNy0zLjAwMDA2LTRoNnoiLz48cGF0aCBkPSJtNC45OTk5NCA3IDMuMDAwMDYgNGgtNnoiLz48L2c+PC9zdmc+';
140+
141+
export const Select = styled(Input).attrs({ as: 'select' })(
142+
css({
143+
appearance: 'none',
144+
backgroundImage: `url(${caret})`,
145+
backgroundRepeat: 'no-repeat',
146+
backgroundPosition: '96% 50%',
147+
})
148+
) as StyledComponent<
149+
'select',
150+
any,
151+
StyledComponentInnerOtherProps<typeof Input>
152+
>;
153+
139154
export const Button = styled.button(
140155
css({
141156
width: '100%',

packages/app/src/app/pages/common/Modals/ShareModal2/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
Description,
3333
Option,
3434
Input,
35+
Select,
3536
TextArea,
3637
Button,
3738
Preview,
@@ -194,9 +195,7 @@ function ShareModal() {
194195
or documentation
195196
</Description>
196197
<Option>
197-
<Input
198-
as="select"
199-
placeholder="Select an preset"
198+
<Select
200199
onChange={event => applyPreset(event.target.value)}
201200
value={settings.preset}
202201
>
@@ -205,7 +204,7 @@ function ShareModal() {
205204
<option value="code-only">Code only</option>
206205
<option value="code-with-tests">Code with tests</option>
207206
<option value="custom">Custom</option>
208-
</Input>
207+
</Select>
209208
</Option>
210209
<Option>
211210
Dark theme

0 commit comments

Comments
 (0)