-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: storybook migrate segment, timepicker, select, toast (#137)
* chore: migrated segment * chore: storybook addon typescript fix * chore: segment component types * chore: timepicker migrate * chore: wip migrate Toast * chore: use createPreviewTabs * chore: migrate toast * chore: migrate select * chore: removed comments and add MultiCheckbox component * chore: updated imports and improved toast components * chore: trying to fix build * chore: trying to fix build 2
- Loading branch information
1 parent
9538982
commit f6004ef
Showing
24 changed files
with
883 additions
and
539 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
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,30 @@ | ||
import React from "react"; | ||
import { | ||
Segment, | ||
SegmentField, | ||
useSegmentState, | ||
SegmentStateProps, | ||
} from "renderless-components"; | ||
|
||
interface AppProps extends SegmentStateProps {} | ||
|
||
export const App: React.FC<AppProps> = props => { | ||
const state = useSegmentState(props); | ||
|
||
return ( | ||
<div> | ||
<SegmentField {...state} className="segment__field"> | ||
{state.segments.map((segment, i) => ( | ||
<Segment | ||
key={i} | ||
segment={segment} | ||
className="segment__field--item" | ||
{...state} | ||
/> | ||
))} | ||
</SegmentField> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
File renamed without changes.
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
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,90 @@ | ||
import React from "react"; | ||
import { CompositeInitialState, PopoverInitialState } from "reakit"; | ||
import { | ||
Select, | ||
SelectMenu, | ||
SelectInput, | ||
SelectOption, | ||
useSelectState, | ||
SelectInitialState, | ||
} from "renderless-components"; | ||
|
||
const countries = [ | ||
{ name: "australia", emoji: "🇦🇺" }, | ||
{ name: "russia", emoji: "🇷🇺" }, | ||
{ name: "new zealand", emoji: "🇳🇿" }, | ||
{ name: "india", emoji: "🇮🇳" }, | ||
{ name: "niger", emoji: "🇳🇪" }, | ||
{ name: "canada", emoji: "🇨🇦" }, | ||
{ name: "indonesia", emoji: "🇮🇩" }, | ||
{ name: "portugal", emoji: "🇵🇹" }, | ||
{ name: "norway", emoji: "🇳🇴" }, | ||
{ name: "switzerland", emoji: "🇨🇭" }, | ||
{ name: "africa", emoji: "🇨🇫" }, | ||
{ name: "colombia", emoji: "🇨🇴" }, | ||
{ name: "costa rica", emoji: "🇨🇷" }, | ||
{ name: "zimbabwe", emoji: "🇿🇼" }, | ||
]; | ||
|
||
type AppProps = Omit< | ||
SelectInitialState, | ||
keyof (PopoverInitialState & CompositeInitialState) | ||
>; | ||
|
||
export const App: React.FC<AppProps> = props => { | ||
const state = useSelectState({ | ||
...props, | ||
allowMultiselect: true, | ||
selected: "india", | ||
isCombobox: true, | ||
}); | ||
|
||
return ( | ||
<Select | ||
{...state} | ||
className="select" | ||
onChange={(value: any) => console.log(value)} | ||
> | ||
<div className="select__header"> | ||
{state.selected.map(item => ( | ||
<span className="select__chip"> | ||
<span> {item}</span> | ||
<button | ||
onClick={e => { | ||
e.stopPropagation(); | ||
state.removeSelected(item); | ||
}} | ||
> | ||
x | ||
</button> | ||
</span> | ||
))} | ||
<SelectInput | ||
className="select__input" | ||
placeholder={state.isPlaceholder ? "Select.." : ""} | ||
{...state} | ||
></SelectInput> | ||
</div> | ||
|
||
<SelectMenu className="select__dropdown" {...state}> | ||
{countries.map(item => { | ||
return ( | ||
item.name.match(state.inputValue) && | ||
!state.selected.includes(item.name) && ( | ||
<SelectOption | ||
className="select__dropdown--item" | ||
{...state} | ||
key={item.name} | ||
value={item.name} | ||
> | ||
{item.name} | ||
</SelectOption> | ||
) | ||
); | ||
})} | ||
</SelectMenu> | ||
</Select> | ||
); | ||
}; | ||
|
||
export default App; |
Oops, something went wrong.