-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement SelectorInput #18
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
require('../src/components/Header/Header.story'); | ||
require('../src/components/Countdown/Countdown.story.js'); | ||
require('../src/components/SelectorInput/SelectorInput.story.js'); |
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,47 @@ | ||
import { h } from 'preact'; | ||
|
||
import * as Colors from './selector-input-color-palette'; | ||
|
||
const SelectorInput = ({ onChange, disabled }) => ( | ||
<input | ||
type="text" | ||
onChange={e => onChange(e.target.value)} | ||
disabled={disabled} | ||
placeholder="Enter your selector here..." | ||
> | ||
<style jsx>{` | ||
input { | ||
width: 100%; | ||
flex: 1; | ||
box-sizing: border-box; | ||
outline: none; | ||
padding: 20px; | ||
background: ${Colors.BACKGROUND}; | ||
border: 1px solid ${Colors.BORDER}; | ||
border-radius: 3px; | ||
color: ${Colors.TEXT}; | ||
align-self: center; | ||
font-family: monospace; | ||
font-size: 16px; | ||
} | ||
|
||
input:focus { | ||
border: 1px solid ${Colors.BORDER_FOCUSED}; | ||
box-shadow: | ||
0 0 4px 0px ${Colors.BOX_SHADOW_FOCUSED} inset, | ||
0 0 4px 0px ${Colors.BOX_SHADOW_FOCUSED}; | ||
} | ||
|
||
input:disabled { | ||
background: ${Colors.BACKGROUND_DISABLED}; | ||
color: ${Colors.TEXT_DISABLED}; | ||
} | ||
|
||
input::placeholder { | ||
color: ${Colors.PLACEHOLDER}; | ||
} | ||
`}</style> | ||
</input> | ||
); | ||
|
||
export { SelectorInput }; |
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,18 @@ | ||
import { h } from 'preact'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
import { SelectorInput } from './SelectorInput'; | ||
|
||
storiesOf('SelectorInput', module) | ||
.add('default', () => ( | ||
<SelectorInput | ||
onChange={action('onChange')} | ||
/> | ||
)) | ||
.add('disabled', () => ( | ||
<SelectorInput | ||
onChange={action('onChange')} | ||
disabled | ||
/> | ||
)); |
10 changes: 10 additions & 0 deletions
10
src/components/SelectorInput/selector-input-color-palette.js
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,10 @@ | ||
export const BACKGROUND = '#2f5e5a'; | ||
export const BORDER = '#739c92'; | ||
export const TEXT = '#fff'; | ||
export const PLACEHOLDER = '#badece'; | ||
|
||
export const BORDER_FOCUSED = 'rgba(248, 217, 64, 0.4)'; | ||
export const BOX_SHADOW_FOCUSED = 'rgba(248, 217, 64, 0.2)'; | ||
|
||
export const BACKGROUND_DISABLED = 'rgba(84, 165, 158, 0.5)'; | ||
export const TEXT_DISABLED = '#b5bdbd'; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we already have / plan to have a global palette? I believe the same colours will used in other components (like Round Name, Pearl Thread etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have time for that, I'd also reorganise the palette a bit into colors and their semantic assignments. That's if we really have a fixed (minimal number of colors) color palette, which is generally a good thing.
Smth. like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be easier to implement components in this way and later extract same colors to color palette.
Agree, I prefer smth like
BRAND_PRIMARY
,BRAND_ACCENT
etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let's just maybe create a task/issue for that?
Concerning white, it's just that pure white is not recommended as such, it's too "technical" a color — shades of white, warm or cool, should be preferred.
BRAND_PRIMARY
and such would be semantic names.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍