From d330f0b6d50bdd1131bcad9a136780317f272cd5 Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Wed, 29 Jul 2020 12:16:33 -0400 Subject: [PATCH] StyleInput: update style and use react-dropdown-select --- package.json | 1 + src/components/StyleInput/StyleInput.css | 93 ++++++++++++++++++++++++ src/components/StyleInput/StyleInput.tsx | 59 ++++++++++----- 3 files changed, 135 insertions(+), 18 deletions(-) create mode 100644 src/components/StyleInput/StyleInput.css diff --git a/package.json b/package.json index 48192fe..8539f99 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "phosphor-react": "^0.1.6", "react": "^16.13.1", "react-dom": "^16.13.1", + "react-dropdown-select": "^4.4.2", "react-list": "^0.8.15", "react-scripts": "3.4.1", "react-use": "^15.3.2", diff --git a/src/components/StyleInput/StyleInput.css b/src/components/StyleInput/StyleInput.css new file mode 100644 index 0000000..6aea3da --- /dev/null +++ b/src/components/StyleInput/StyleInput.css @@ -0,0 +1,93 @@ +/* .style-select { + position: relative; +} + +.style-select { + background-color: gold; + border-radius: 24px; + box-shadow: 4px 4px #ccc; + display: none; +} + +.style-select option { + background-color: gold; + border-radius: 24px; + display: none; +} */ + +.react-dropdown-select { + width: 176px !important; + height: 48px !important; + margin: 0 4px; + padding: 0 24px !important; + color: white; + border-radius: 8px !important; + background-color: #494650; + font-size: 16px; + border: none !important; +} + +.react-dropdown-select-content span { + box-sizing: initial !important; +} + +.react-dropdown-select:focus-within { + background-color: white; + color: black; + outline: none !important; + box-shadow: none !important; +} + +.react-dropdown-select-type-single { + /* height: 100% !important; */ +} + +.react-dropdown-select-clear, +.react-dropdown-select-dropdown-handle { + /* color: #fff; */ +} +.react-dropdown-select-option { + /* border: 1px solid #000; */ +} +.react-dropdown-select-item { + color: #333; + height: 100% !important; + +} +.react-dropdown-select-input { + color: #fff; +} +.react-dropdown-select-dropdown { + position: absolute; + left: 0; + border: none; + width: 500px; + padding: 0; + display: flex; + flex-direction: column; + border-radius: 8px; + max-height: 300px; + overflow: auto; + z-index: 9; + /* background: rgb(29, 20, 20) !important; */ + box-shadow: none; +} +.react-dropdown-select-item { + color: black; +} +.react-dropdown-select-item:hover { + /* color: white; */ + background-color: #ffd171 !important; +} + +.react-dropdown-select-item.react-dropdown-select-item-selected, +.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.react-dropdown-select-item-disabled { + background: #777; + color: #ccc; +} diff --git a/src/components/StyleInput/StyleInput.tsx b/src/components/StyleInput/StyleInput.tsx index ebef085..d31ee7e 100644 --- a/src/components/StyleInput/StyleInput.tsx +++ b/src/components/StyleInput/StyleInput.tsx @@ -1,34 +1,57 @@ import React from "react"; import { useRecoilState } from "recoil"; +import Select from "react-dropdown-select"; import { styleQueryAtom } from "../../state/atoms"; import { IconStyle } from "../../lib"; +import "./StyleInput.css"; +import { Heart } from "phosphor-react"; + +const options = [ + { key: "Thin", value: IconStyle.THIN, icon: }, + { key: "Light", value: IconStyle.LIGHT, icon: }, + { + key: "Regular", + value: IconStyle.REGULAR, + icon: , + }, + { key: "Bold", value: IconStyle.BOLD, icon: }, + { key: "Fill", value: IconStyle.FILL, icon: }, + { + key: "Duotone", + value: IconStyle.DUOTONE, + icon: , + }, +]; type StyleInputProps = {}; const StyleInput: React.FC = () => { const [style, setStyle] = useRecoilState(styleQueryAtom); + void style; - const handleStyleChange = (event: React.ChangeEvent) => { - setStyle(event.target.value as IconStyle); - }; + // const handleStyleChange = (event: React.ChangeEvent) => { + // setStyle(event.target.value as IconStyle); + // }; return ( -
- -
+