diff --git a/package-lock.json b/package-lock.json index ed5b37e..06688df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@codex-storage/marketplace-ui-components", - "version": "0.0.5", + "version": "0.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@codex-storage/marketplace-ui-components", - "version": "0.0.5", + "version": "0.0.6", "license": "MIT", "dependencies": { "lucide-react": "^0.441.0" @@ -1544,9 +1544,9 @@ "dev": true }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.2.tgz", - "integrity": "sha512-8Ao+EDmTPjZ1ZBABc1ohN7Ylx7UIYcjReZinigedTOnGFhIctyGPxY2II+hJ6gD2/vkDKZTyQ0e7++kwv6wDrw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", + "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", "cpu": [ "arm" ], @@ -1558,9 +1558,9 @@ "peer": true }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.2.tgz", - "integrity": "sha512-I+B1v0a4iqdS9DvYt1RJZ3W+Oh9EVWjbY6gp79aAYipIbxSLEoQtFQlZEnUuwhDXCqMxJ3hluxKAdPD+GiluFQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", + "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", "cpu": [ "arm64" ], @@ -1572,9 +1572,9 @@ "peer": true }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.2.tgz", - "integrity": "sha512-BTHO7rR+LC67OP7I8N8GvdvnQqzFujJYWo7qCQ8fGdQcb8Gn6EQY+K1P+daQLnDCuWKbZ+gHAQZuKiQkXkqIYg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", + "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", "cpu": [ "arm64" ], @@ -1586,9 +1586,9 @@ "peer": true }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.2.tgz", - "integrity": "sha512-1esGwDNFe2lov4I6GsEeYaAMHwkqk0IbuGH7gXGdBmd/EP9QddJJvTtTF/jv+7R8ZTYPqwcdLpMTxK8ytP6k6Q==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", + "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", "cpu": [ "x64" ], @@ -1600,9 +1600,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.2.tgz", - "integrity": "sha512-GBHuY07x96OTEM3OQLNaUSUwrOhdMea/LDmlFHi/HMonrgF6jcFrrFFwJhhe84XtA1oK/Qh4yFS+VMREf6dobg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", + "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", "cpu": [ "arm" ], @@ -1614,9 +1614,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.2.tgz", - "integrity": "sha512-Dbfa9Sc1G1lWxop0gNguXOfGhaXQWAGhZUcqA0Vs6CnJq8JW/YOw/KvyGtQFmz4yDr0H4v9X248SM7bizYj4yQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", + "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", "cpu": [ "arm" ], @@ -1628,9 +1628,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.2.tgz", - "integrity": "sha512-Z1YpgBvFYhZIyBW5BoopwSg+t7yqEhs5HCei4JbsaXnhz/eZehT18DaXl957aaE9QK7TRGFryCAtStZywcQe1A==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", + "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", "cpu": [ "arm64" ], @@ -1642,9 +1642,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.2.tgz", - "integrity": "sha512-66Zszr7i/JaQ0u/lefcfaAw16wh3oT72vSqubIMQqWzOg85bGCPhoeykG/cC5uvMzH80DQa2L539IqKht6twVA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", + "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", "cpu": [ "arm64" ], @@ -1656,9 +1656,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.2.tgz", - "integrity": "sha512-HpJCMnlMTfEhwo19bajvdraQMcAq3FX08QDx3OfQgb+414xZhKNf3jNvLFYKbbDSGBBrQh5yNwWZrdK0g0pokg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", + "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", "cpu": [ "ppc64" ], @@ -1670,9 +1670,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.2.tgz", - "integrity": "sha512-/egzQzbOSRef2vYCINKITGrlwkzP7uXRnL+xU2j75kDVp3iPdcF0TIlfwTRF8woBZllhk3QaxNOEj2Ogh3t9hg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", + "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", "cpu": [ "riscv64" ], @@ -1684,9 +1684,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.2.tgz", - "integrity": "sha512-qgYbOEbrPfEkH/OnUJd1/q4s89FvNJQIUldx8X2F/UM5sEbtkqZpf2s0yly2jSCKr1zUUOY1hnTP2J1WOzMAdA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", + "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", "cpu": [ "s390x" ], @@ -1698,9 +1698,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.2.tgz", - "integrity": "sha512-a0lkvNhFLhf+w7A95XeBqGQaG0KfS3hPFJnz1uraSdUe/XImkp/Psq0Ca0/UdD5IEAGoENVmnYrzSC9Y2a2uKQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", + "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", "cpu": [ "x64" ], @@ -1712,9 +1712,9 @@ "peer": true }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.2.tgz", - "integrity": "sha512-sSWBVZgzwtsuG9Dxi9kjYOUu/wKW+jrbzj4Cclabqnfkot8Z3VEHcIgyenA3lLn/Fu11uDviWjhctulkhEO60g==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", + "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", "cpu": [ "x64" ], @@ -1726,9 +1726,9 @@ "peer": true }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.2.tgz", - "integrity": "sha512-t/YgCbZ638R/r7IKb9yCM6nAek1RUvyNdfU0SHMDLOf6GFe/VG1wdiUAsxTWHKqjyzkRGg897ZfCpdo1bsCSsA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", + "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", "cpu": [ "arm64" ], @@ -1740,9 +1740,9 @@ "peer": true }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.2.tgz", - "integrity": "sha512-kTmX5uGs3WYOA+gYDgI6ITkZng9SP71FEMoHNkn+cnmb9Zuyyay8pf0oO5twtTwSjNGy1jlaWooTIr+Dw4tIbw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", + "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", "cpu": [ "ia32" ], @@ -1754,9 +1754,9 @@ "peer": true }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.2.tgz", - "integrity": "sha512-Yy8So+SoRz8I3NS4Bjh91BICPOSVgdompTIPYTByUqU66AXSIOgmW3Lv1ke3NORPqxdF+RdrZET+8vYai6f4aA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", + "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", "cpu": [ "x64" ], @@ -6463,9 +6463,9 @@ } }, "node_modules/rollup": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.2.tgz", - "integrity": "sha512-JWWpTrZmqQGQWt16xvNn6KVIUz16VtZwl984TKw0dfqqRpFwtLJYYk1/4BTgplndMQKWUk/yB4uOShYmMzA2Vg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", + "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", "dev": true, "peer": true, "dependencies": { @@ -6479,22 +6479,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.22.2", - "@rollup/rollup-android-arm64": "4.22.2", - "@rollup/rollup-darwin-arm64": "4.22.2", - "@rollup/rollup-darwin-x64": "4.22.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.22.2", - "@rollup/rollup-linux-arm-musleabihf": "4.22.2", - "@rollup/rollup-linux-arm64-gnu": "4.22.2", - "@rollup/rollup-linux-arm64-musl": "4.22.2", - "@rollup/rollup-linux-powerpc64le-gnu": "4.22.2", - "@rollup/rollup-linux-riscv64-gnu": "4.22.2", - "@rollup/rollup-linux-s390x-gnu": "4.22.2", - "@rollup/rollup-linux-x64-gnu": "4.22.2", - "@rollup/rollup-linux-x64-musl": "4.22.2", - "@rollup/rollup-win32-arm64-msvc": "4.22.2", - "@rollup/rollup-win32-ia32-msvc": "4.22.2", - "@rollup/rollup-win32-x64-msvc": "4.22.2", + "@rollup/rollup-android-arm-eabi": "4.22.4", + "@rollup/rollup-android-arm64": "4.22.4", + "@rollup/rollup-darwin-arm64": "4.22.4", + "@rollup/rollup-darwin-x64": "4.22.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", + "@rollup/rollup-linux-arm-musleabihf": "4.22.4", + "@rollup/rollup-linux-arm64-gnu": "4.22.4", + "@rollup/rollup-linux-arm64-musl": "4.22.4", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", + "@rollup/rollup-linux-riscv64-gnu": "4.22.4", + "@rollup/rollup-linux-s390x-gnu": "4.22.4", + "@rollup/rollup-linux-x64-gnu": "4.22.4", + "@rollup/rollup-linux-x64-musl": "4.22.4", + "@rollup/rollup-win32-arm64-msvc": "4.22.4", + "@rollup/rollup-win32-ia32-msvc": "4.22.4", + "@rollup/rollup-win32-x64-msvc": "4.22.4", "fsevents": "~2.3.2" } }, diff --git a/package.json b/package.json index c9f271a..8f3de36 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "git", "url": "https://github.com/codex-storage/codex-marketplace-ui-components" }, - "version": "0.0.5", + "version": "0.0.6", "type": "module", "scripts": { "prepack": "npm run build", diff --git a/src/components/Dropdown/Dropdown.tsx b/src/components/Dropdown/Dropdown.tsx index e9362d4..f367c4f 100644 --- a/src/components/Dropdown/Dropdown.tsx +++ b/src/components/Dropdown/Dropdown.tsx @@ -9,6 +9,7 @@ import "./dropdown.css"; import { attributes } from "../utils/attributes"; import { Backdrop } from "../Backdrop/Backdrop"; import { Input, InputCustomStyleCSS } from "../Input/Input"; +import { classnames } from "../utils/classnames"; interface CustomStyleCSS extends InputCustomStyleCSS { "--codex-dropdown-panel-background"?: string; @@ -143,7 +144,7 @@ export function Dropdown({ ( diff --git a/src/components/InputGroup/InputGroup.tsx b/src/components/InputGroup/InputGroup.tsx index bf88fce..073a461 100644 --- a/src/components/InputGroup/InputGroup.tsx +++ b/src/components/InputGroup/InputGroup.tsx @@ -1,4 +1,4 @@ -import { ChangeEvent, CSSProperties } from "react"; +import { ChangeEvent, CSSProperties, LegacyRef } from "react"; import "./inputGroup.css"; import { Input } from "../Input/Input"; import { Select } from "../Select/Select"; @@ -77,9 +77,11 @@ type Props = { */ helper?: string; - min?: number; + min?: number | string; - max?: number; + max?: number | string; + + inputRef?: LegacyRef; }; export function InputGroup({ @@ -89,7 +91,7 @@ export function InputGroup({ type = "text", style, group, - className, + className = "", inputClassName = "", onChange, onGroupChange, @@ -101,6 +103,7 @@ export function InputGroup({ step, value = undefined, groupValue = "", + inputRef, min, max, }: Props) { @@ -110,6 +113,7 @@ export function InputGroup({
-
{children}
+
{open && children}
{Icon}
{title} + + {subtitle && ( +
+ {subtitle} +
+ )} +
{message}
{onRetry && ( diff --git a/src/components/Placeholder/placeholder.css b/src/components/Placeholder/placeholder.css index d954518..9871de2 100644 --- a/src/components/Placeholder/placeholder.css +++ b/src/components/Placeholder/placeholder.css @@ -1,5 +1,6 @@ .placeholder { text-align: center; + margin: auto; } .placeholder-icon { @@ -12,6 +13,10 @@ display: inline-block; } +.placeholder-subtitle { + margin-bottom: 0.25rem; +} + .placeholder-button { margin: 0.75rem auto 0; } diff --git a/src/components/Select/Select.tsx b/src/components/Select/Select.tsx index e46ead7..653e31a 100644 --- a/src/components/Select/Select.tsx +++ b/src/components/Select/Select.tsx @@ -55,7 +55,7 @@ export function Select({ onMouseEnter, onMouseLeave, style, - className, + className = "", defaultValue, value, }: Props) { diff --git a/src/components/SimpleText/SimpleText.tsx b/src/components/SimpleText/SimpleText.tsx index 9d8cd11..813b832 100644 --- a/src/components/SimpleText/SimpleText.tsx +++ b/src/components/SimpleText/SimpleText.tsx @@ -1,4 +1,4 @@ -import { CSSProperties } from "react"; +import { CSSProperties, ReactNode } from "react"; import "./simpleText.css"; interface CustomStyleCSS extends CSSProperties { @@ -17,7 +17,7 @@ type Props = { className?: string; - children: string; + children: string | ReactNode; /** * Apply custom css variables. diff --git a/src/components/SpaceAllocation/spaceAllocation.css b/src/components/SpaceAllocation/spaceAllocation.css index 5027b40..88d6ba1 100644 --- a/src/components/SpaceAllocation/spaceAllocation.css +++ b/src/components/SpaceAllocation/spaceAllocation.css @@ -33,9 +33,30 @@ background-color: var(--codex-color); } +.nodeSpaceAllocation-quota-3 { + background-color: #cd853f; +} + +.nodeSpaceAllocation-quota-4 { + background-color: #d2b48c; +} + +.nodeSpaceAllocation-quota-5 { + background-color: #ffdab9; +} + +.nodeSpaceAllocation-quota-6 { + background-color: #ffb74d; +} + +.nodeSpaceAllocation-quota-7 { + background-color: #9c27b0; +} + .nodeSpaceAllocation-legend { display: flex; gap: 0.75rem; + flex-wrap: wrap; } .nodeSpaceAllocation-legendItem { diff --git a/src/components/Stepper/Stepper.tsx b/src/components/Stepper/Stepper.tsx index 21347ff..fa67313 100644 --- a/src/components/Stepper/Stepper.tsx +++ b/src/components/Stepper/Stepper.tsx @@ -71,7 +71,7 @@ export function Stepper({ state, style, dispatch, - className, + className = "", backLabel = "Back", nextLabel = "Next", duration = 500, diff --git a/src/components/Stepper/useStepperReducer.tsx b/src/components/Stepper/useStepperReducer.tsx index c273a5a..16121bd 100644 --- a/src/components/Stepper/useStepperReducer.tsx +++ b/src/components/Stepper/useStepperReducer.tsx @@ -37,6 +37,10 @@ export type StepperAction = | { type: "toggle-next"; isNextEnable: boolean; + } + | { + type: "toggle-back"; + isBackEnable: boolean; }; export type StepperBodyProps = { @@ -48,73 +52,57 @@ export type StepperBodyProps = { * The storage key allows to save the step when the user * move from a step to another. */ -const reducer = - (steps: number) => (state: StepperState, action: StepperAction) => { - switch (action.type) { - case "close": { - return { - ...state, - step: 0, - isNextDisable: true, - progress: false, - open: false, - isBackEnable: true, - }; - } - - case "open": { - return { - ...state, - step: 0, - isNextDisable: true, - progress: false, - open: true, - isBackEnable: true, - }; - } - - case "loading": { - if (action.step >= steps) { - return { - ...state, - step: 0, - isNextDisable: true, - progress: false, - open: false, - isBackEnable: true, - }; - } - - // WebStorage.set(storageKey, action.step); - - return { - ...state, - step: action.step, - isNextDisable: true, - progress: true, - isBackEnable: action.step != steps - 1, - }; - } - - case "next": { - return { - ...state, - progress: false, - }; - } - - case "toggle-next": { - return { - ...state, - isNextEnable: action.isNextEnable, - }; - } +const reducer = () => (state: StepperState, action: StepperAction) => { + switch (action.type) { + case "close": { + return { + ...state, + open: false, + }; } - }; -export function useStepperReducer(steps: number) { + case "open": { + return { + ...state, + open: true, + }; + } + + case "loading": { + return { + ...state, + step: action.step, + progress: true, + }; + } + + case "next": { + return { + ...state, + progress: false, + step: action.step, + }; + } + + case "toggle-next": { + return { + ...state, + isNextEnable: action.isNextEnable, + }; + } + + case "toggle-back": { + return { + ...state, + isBackEnable: action.isBackEnable, + }; + } + } +}; + +export function useStepperReducer() { const [state, dispatch] = useReducer>( - reducer(steps), + reducer(), { step: 0, isNextEnable: false, diff --git a/src/components/Table/Table.css b/src/components/Table/Table.css index e26e705..a423c87 100644 --- a/src/components/Table/Table.css +++ b/src/components/Table/Table.css @@ -39,6 +39,11 @@ .table-tbodyTr { border-bottom: 1px solid var(--codex-border-color); + transition: background-color 0.35s; +} + +.table-tbodyTr:hover { + background-color: var(--codex-background-light); } .table-tbodyTd { diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx index 4ca3071..2272fd3 100644 --- a/src/components/Table/Table.tsx +++ b/src/components/Table/Table.tsx @@ -18,7 +18,7 @@ type Props = { className?: string; }; -export function Table({ headers, cells, className }: Props) { +export function Table({ headers, cells, className = "" }: Props) { return (
@@ -34,15 +34,11 @@ export function Table({ headers, cells, className }: Props) { {cells.map((row, index) => ( - {headers.map((header, idx) => { - const cell = row[idx]; - - return ( - - ); - })} + {headers.map((header, idx) => ( + + ))} ))}
- {cell} - + {row[idx]} +