File tree Expand file tree Collapse file tree 3 files changed +36
-17
lines changed Expand file tree Collapse file tree 3 files changed +36
-17
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,15 @@ import { GlobalStyle } from './style/Global'
77import { Schedule } from './Schedule'
88import { format } from 'date-fns'
99import { ThemeProvider } from 'styled-components'
10- import { Button , Input , DateEditor , StyledDaySelector } from './style/Form'
10+ import {
11+ Button ,
12+ Input ,
13+ DateEditor ,
14+ StyledDaySelector ,
15+ StyledTimeZoneSelector ,
16+ } from './style/Form'
1117import { Editor } from './Editor'
1218import { ThemeSwitcher } from './ThemeSwitcher'
13- import { TimeZoneSelector } from './timezones'
1419
1520import LockIcon from 'feather-icons/dist/icons/lock.svg'
1621import UnLockIcon from 'feather-icons/dist/icons/unlock.svg'
@@ -99,7 +104,7 @@ export const App = () => {
99104 onChange = { ( { target : { value } } ) => updateName ( value ) }
100105 />
101106 < StyledDaySelector day = { updatedDay } onUpdate = { updateDay } />
102- < TimeZoneSelector
107+ < StyledTimeZoneSelector
103108 value = { updatedTimeZone }
104109 onChange = { ( { target : { value } } ) => updateTimeZone ( value ) }
105110 />
Original file line number Diff line number Diff line change 11import styled from 'styled-components'
22import { DaySelector } from '../DaySelector'
3+ import { TimeZoneSelector } from '../timezones'
34import { wideBreakpoint , mobileBreakpoint } from './settings'
45
56export const Button = styled . button `
@@ -46,6 +47,18 @@ export const StyledDaySelector = styled(DaySelector)`
4647 }
4748`
4849
50+ export const StyledTimeZoneSelector = styled ( TimeZoneSelector ) `
51+ background-color: transparent;
52+ border: 1px solid ${ ( props ) => props . theme . colors . text } ;
53+ padding: 0.25rem 0.5rem;
54+ height: 40px;
55+ color: ${ ( props ) => props . theme . colors . text } ;
56+ option {
57+ color: black;
58+ }
59+ margin: 0;
60+ `
61+
4962export const NumberInput = styled ( Input ) `
5063 width: 30px;
5164 @media (min-width: ${ mobileBreakpoint } ) {
@@ -57,17 +70,7 @@ export const DateEditor = styled.div`
5770 display: flex;
5871 flex-direction: column;
5972 align-items: center;
60- select {
61- height: 30px;
62- }
63- ${ Input } + ${ Input } , ${ Input } + select {
64- margin-top: 0.5rem;
65- }
6673 @media (min-width: ${ wideBreakpoint } ) {
6774 flex-direction: row;
68- ${ Input } + ${ Input } , ${ Input } + select {
69- margin-left: 0.5rem;
70- margin-top: 0;
71- }
7275 }
7376`
Original file line number Diff line number Diff line change @@ -349,7 +349,7 @@ export const timezones = [
349349 'Pacific/Tongatapu' ,
350350 'Pacific/Wake' ,
351351 'Pacific/Wallis' ,
352- ] as const
352+ ]
353353
354354export const TimeZoneSelector = (
355355 props : React . DetailedHTMLProps <
@@ -358,8 +358,19 @@ export const TimeZoneSelector = (
358358 > ,
359359) => (
360360 < select { ...props } >
361- { timezones . map ( ( tz ) => (
362- < option key = { tz } > { tz } </ option >
363- ) ) }
361+ { timezones
362+ . sort ( ( a , b ) => {
363+ const [ , a2 , a3 ] = a . split ( '/' )
364+ const [ , b2 , b3 ] = b . split ( '/' )
365+ return ( a3 ?? a2 ) . localeCompare ( b3 ?? b2 )
366+ } )
367+ . map ( ( tz ) => {
368+ const [ t1 , t2 , t3 ] = tz . split ( '/' )
369+ return (
370+ < option key = { tz } value = { tz } >
371+ { t3 ?? t2 } ({ t3 === undefined ? t1 : `${ t1 } /${ t2 } ` } )
372+ </ option >
373+ )
374+ } ) }
364375 </ select >
365376)
You can’t perform that action at this time.
0 commit comments