This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
❤️ these confounded tests drive me nuts 😍
- Loading branch information
Showing
8 changed files
with
948 additions
and
744 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react' | ||
import { useStoreState, useStoreActions } from 'easy-peasy' | ||
|
||
const SelectLanguage = () => { | ||
const { languages } = useStoreState(state => state.settings) | ||
const { updateLanguage } = useStoreActions(actions => actions.settings) | ||
|
||
const handleChange = event => { | ||
if (!languages.includes(event.target.value)) { | ||
return 0 | ||
} | ||
|
||
updateLanguage(event.target.value) | ||
} | ||
|
||
return ( | ||
<div className='inline-block relative w-64'> | ||
<select | ||
onChange={handleChange} | ||
className='block appearance-none w-full bg-white border border-gray-400 hover:border-gray-500 px-4 py-2 pr-8 rounded shadow leading-tight focus:outline-none focus:shadow-outline' | ||
> | ||
<option value='en_GB'>English</option> | ||
<option value='fr_FR'>Français</option> | ||
</select> | ||
<div className='pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700'> | ||
<svg | ||
className='fill-current h-4 w-4' | ||
xmlns='http://www.w3.org/2000/svg' | ||
viewBox='0 0 20 20' | ||
> | ||
<path d='M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z' /> | ||
</svg> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export { SelectLanguage } |
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,38 @@ | ||
import React from 'react' | ||
import { useStoreState, useStoreActions } from 'easy-peasy' | ||
|
||
const SelectUnit = () => { | ||
const { units } = useStoreState(state => state.settings) | ||
const { updateUnit } = useStoreActions(actions => actions.settings) | ||
|
||
const handleChange = event => { | ||
if (!units.includes(event.target.value)) { | ||
return 0 | ||
} | ||
|
||
updateUnit(event.target.value) | ||
} | ||
|
||
return ( | ||
<div className='inline-block relative w-64'> | ||
<select | ||
onChange={handleChange} | ||
className='block appearance-none w-full bg-white border border-gray-400 hover:border-gray-500 px-4 py-2 pr-8 rounded shadow leading-tight focus:outline-none focus:shadow-outline' | ||
> | ||
<option value='C'>Celsius °C</option> | ||
<option value='F'>Fahrenheit °F</option> | ||
</select> | ||
<div className='pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700'> | ||
<svg | ||
className='fill-current h-4 w-4' | ||
xmlns='http://www.w3.org/2000/svg' | ||
viewBox='0 0 20 20' | ||
> | ||
<path d='M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z' /> | ||
</svg> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export { SelectUnit } |
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,9 +1,17 @@ | ||
import { action } from 'easy-peasy' | ||
|
||
const settingsModel = { | ||
language: 'en_GB', | ||
pollInterval: 1000, // ms | ||
unit: 'C' // accepted values: 'C' or 'F' | ||
language: 'en_GB', | ||
languages: ['en_GB', 'fr_FR'], | ||
updateLanguage: action((state, payload) => { | ||
state.language = payload | ||
}), | ||
unit: 'C', | ||
units: ['C', 'F'], | ||
updateUnit: action((state, payload) => { | ||
state.unit = payload | ||
}) | ||
} | ||
|
||
export default settingsModel |
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
Oops, something went wrong.