-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat(primitive): add select component #78
Conversation
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.
Looks good! I left few comments, but most of them is related to the inconsistency between Prettier and Eslint. Fyi, I'm working on VSCode with eslint and prettier plugins, so Prettier fixes my code whenever I save the file.
|
||
// when | ||
await act(async () => { | ||
render(<ThemeProvider theme={themes.light}><Select label="Test select label" value={options[0]} options={options} onChange={() => null} /></ThemeProvider>) |
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.
This line seems to be too long (around 160 characters long). Prettier should try to wrap this. I found that eslint won't complain on this. Maybe we should add max-len
rule to eslint config (as warning)? What do you think? Prettier uses on 80 characters limit.
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 connected prettier to eslint and ran lint:fix
, it should be good now
} | ||
|
||
type Option = { value: string; label: string; key: string; } | ||
export type MyListboxProps = { |
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.
export type MyListboxProps = { | |
export type SelectProps = { |
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.
renamed
import ArrowBottom from '../../styles/Icons/ArrowBottom1' | ||
|
||
import { Label, SelectButton, SelectorIcon, OptionsContainer, Option } from './styles' | ||
import { MyListboxProps } from './types' |
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.
import { MyListboxProps } from './types' | |
import { SelectProps } from './types' |
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.
renamed
* @prop {string} label - label shown in option | ||
* @prop {string} key - key to be used in react map | ||
*/ | ||
const Select = ({ value, options, onChange, inverted, label }: MyListboxProps) => { |
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.
const Select = ({ value, options, onChange, inverted, label }: MyListboxProps) => { | |
const Select = ({ value, options, onChange, inverted, label }: SelectProps) => { |
/> | ||
</div> | ||
|
||
|
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.
Here are 2 empty lines - another inconsistency between prettier and eslint. Maybe we should add no-multiple-empty-lines
rule?
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 connected prettier to eslint and ran lint:fix, it should be good now
@@ -1,9 +1,16 @@ | |||
import darkTheme from './dark' | |||
import lightTheme from './light' | |||
|
|||
const withShared = theme => ({ | |||
...theme, | |||
borderRadius: (count = 1) => `${count * 10}px`, |
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.
Cool! Just curious: how did you pick up the base values (10px
, 0.7px
and 1.3px
)?
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.
pure guess
looked good, but I thought this way it will be easier to adjust them 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.
LGTM! You can switch to describe-it
in the Select.test.tsx
. But it's minor, and eventually can be changed later to not block this PR.
import themes from '../../styles/themes' | ||
import Select from './' | ||
|
||
test('renders label with select', async () => { |
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.
NIT: We used to:
describe('Component name', () => {
it('should render X', () => {})
})
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.
will do on next branch ,thanks
Description
@ #63
Motivation and Context
How Has This Been Tested?
run and tested manually



