Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

feat: add SelectDropdown component #2184

Merged
merged 6 commits into from
Jun 18, 2020

Conversation

goga-m
Copy link
Contributor

@goga-m goga-m commented Jun 18, 2020

Summary

Dropdown themed as select list to be used with custom HTML options.
Using downshift internally.

Usage:

	const options = [
		{
			label: "Option 1",
			value: "1",
		},
		{
			label: "Option 2",
			value: "2",
		},
		{
			label: "Option 3",
			value: "3",
		},
	];

	return (
		<div className="">
			<div className="mt-10 w-128">
				<SelectDropdown
					option={(option: any) => {
						return (
							<div className="p-2 border-b border-theme-neutral-200 hover:bg-theme-neutral-100">
								{option.label}
							</div>
						);
					}}
					toggle={(selected: any) => {
						if (selected) {
							return (
								<div className="flex flex-inline items-center">
									<div>{selected.label}</div>
								</div>
							);
						}
						return (
							<div className="flex flex-inline items-center">
								<div className="text-theme-neutral-800 font-semibold">Select Option</div>
							</div>
						);
					}}
					options={options}
				></SelectDropdown>

Checklist

  • Documentation (if necessary)
  • Tests (if necessary)
  • Ready to be merged

@goga-m goga-m requested a review from faustbrian as a code owner June 18, 2020 14:02
@ghost ghost added Complexity: High More than 256 lines changed. Type: Feature The issue is a request for new functionality. labels Jun 18, 2020
@goga-m goga-m changed the title feat: add DropdownSelect component feat: add SelectDropdown component Jun 18, 2020
@codecov
Copy link

codecov bot commented Jun 18, 2020

Codecov Report

Merging #2184 into 3.0-react will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           3.0-react     #2184    +/-   ##
============================================
  Coverage     100.00%   100.00%            
============================================
  Files             45       117    +72     
  Lines            298       930   +632     
  Branches          49       144    +95     
============================================
+ Hits             298       930   +632     
Flag Coverage Δ
#unit 100.00% <100.00%> (?)
Impacted Files Coverage Δ
src/app/components/Button/Button.tsx 100.00% <ø> (ø)
src/app/components/Card/Card.tsx 100.00% <ø> (ø)
src/app/components/Card/CardControl.tsx 100.00% <ø> (ø)
src/app/components/Circle/Circle.tsx 100.00% <ø> (ø)
src/app/components/Divider/Divider.styles.ts 100.00% <ø> (ø)
src/app/components/Divider/Divider.tsx 100.00% <ø> (ø)
src/app/components/Form/Form.tsx 100.00% <ø> (ø)
src/app/components/Form/FormField.tsx 100.00% <ø> (ø)
src/app/components/Form/FormHelperText.tsx 100.00% <ø> (ø)
src/app/components/Form/FormLabel.tsx 100.00% <ø> (ø)
... and 126 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b50913d...b284ea7. Read the comment docs.

@faustbrian faustbrian merged commit 96726c3 into 3.0-react Jun 18, 2020
@ghost ghost deleted the feat/component-dropdown-select branch June 18, 2020 16:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Complexity: High More than 256 lines changed. Type: Feature The issue is a request for new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants