Sha256: d72481d3425fd3e157067764a47ae09f630122a85cdd501da39d430443b32f80
Contents?: true
Size: 1.47 KB
Versions: 4
Compression:
Stored size: 1.47 KB
Contents
import React, { useState } from 'react' import { Dropdown, Icon, Body, FlexItem, Flex } from '../..' const DropdownWithCustomOptions = (props) => { // eslint-disable-next-line no-unused-vars const [selectedOption, setSelectedOption] = useState(); const options = [ { label: "United States", value: "United States", areaCode: "+1", icon: "πΊπΈ", id: "United-states" }, { label: "Ukraine", value: "Ukraine", areaCode: "+380", icon: "πΊπ¦", id: "ukraine" }, { label: "Pakistan", value: "Pakistan", areaCode: "+92", icon: "π΅π°", id: "pakistan" } ]; return ( <div> <Dropdown onSelect={(selectedItem) => setSelectedOption(selectedItem)} options={options} {...props} > {options.map((option) => ( <Dropdown.Option key={option.id} option={option} > <> <FlexItem> <Flex> <Icon icon={option.icon} paddingRight="xs" /> <Body text={option.label} /> </Flex> </FlexItem> <FlexItem> <Body color="light" text={option.areaCode} /> </FlexItem> </> </Dropdown.Option> ))} </Dropdown> </div> ) } export default DropdownWithCustomOptions
Version data entries
4 entries across 4 versions & 2 rubygems