From 49c9cacc51f7fea74d5d5abcaab3b5fad72ece50 Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Fri, 7 Aug 2020 14:44:55 -0400 Subject: [PATCH] StyleInput: implement custom dropdown with example icons --- src/components/StyleInput/StyleInput.css | 34 ++++++++++---- src/components/StyleInput/StyleInput.tsx | 58 +++++++++++++++++------- 2 files changed, 67 insertions(+), 25 deletions(-) diff --git a/src/components/StyleInput/StyleInput.css b/src/components/StyleInput/StyleInput.css index b511855..4f56e92 100644 --- a/src/components/StyleInput/StyleInput.css +++ b/src/components/StyleInput/StyleInput.css @@ -18,6 +18,7 @@ .react-dropdown-select { width: 176px !important; height: 48px !important; + justify-content: flex-start; margin: 0 4px; padding: 0 24px !important; color: white; @@ -27,8 +28,14 @@ border: none !important; } -.react-dropdown-select-content span { - box-sizing: initial !important; +.react-dropdown-select-content { + display: flex; + align-items: center; + justify-content: flex-start; +} + +.react-dropdown-select-content svg { + margin: 0 12px 0 0; } .react-dropdown-select:focus-within { @@ -46,14 +53,22 @@ .react-dropdown-select-dropdown-handle { /* color: #fff; */ } + .react-dropdown-select-option { /* border: 1px solid #000; */ } + .react-dropdown-select-item { color: #333; - height: 100% !important; - + height: 40px !important; + display: flex; + align-items: center; } + +.react-dropdown-select-item svg { + margin: 0 12px 0 24px; +} + .react-dropdown-select-input { color: #fff; } @@ -65,7 +80,7 @@ padding: 0; display: flex; flex-direction: column; - border-radius: 8px; + border-radius: 8px !important; max-height: 300px; overflow: auto; z-index: 9; @@ -76,7 +91,6 @@ color: black; } .react-dropdown-select-item:hover { - /* color: white; */ background-color: #ffd171 !important; } @@ -84,9 +98,13 @@ .react-dropdown-select-item.react-dropdown-select-item-active { color: black !important; background-color: #ffd171 !important; - /* border-bottom: 1px solid #333; */ - font-weight: bold; } + +.react-dropdown-select-item:focus { + color: black !important; + background-color: #ffd171 !important; +} + .react-dropdown-select-item.react-dropdown-select-item-disabled { background: #777; color: #ccc; diff --git a/src/components/StyleInput/StyleInput.tsx b/src/components/StyleInput/StyleInput.tsx index d31ee7e..e3f9cc0 100644 --- a/src/components/StyleInput/StyleInput.tsx +++ b/src/components/StyleInput/StyleInput.tsx @@ -5,22 +5,38 @@ import Select from "react-dropdown-select"; import { styleQueryAtom } from "../../state/atoms"; import { IconStyle } from "../../lib"; import "./StyleInput.css"; -import { Heart } from "phosphor-react"; +import { PencilLine } from "phosphor-react"; const options = [ - { key: "Thin", value: IconStyle.THIN, icon: }, - { key: "Light", value: IconStyle.LIGHT, icon: }, + { + key: "Thin", + value: IconStyle.THIN, + icon: , + }, + { + key: "Light", + value: IconStyle.LIGHT, + icon: , + }, { key: "Regular", value: IconStyle.REGULAR, - icon: , + icon: , + }, + { + key: "Bold", + value: IconStyle.BOLD, + icon: , + }, + { + key: "Fill", + value: IconStyle.FILL, + icon: , }, - { key: "Bold", value: IconStyle.BOLD, icon: }, - { key: "Fill", value: IconStyle.FILL, icon: }, { key: "Duotone", value: IconStyle.DUOTONE, - icon: , + icon: , }, ]; @@ -36,21 +52,29 @@ const StyleInput: React.FC = () => { return (