Apply multiple minor fixes

This commit is contained in:
Arnaud 2024-09-24 18:59:02 +02:00
parent 065f937b4d
commit 4a59af6f1d
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
16 changed files with 188 additions and 157 deletions

138
package-lock.json generated
View File

@ -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"
}
},

View File

@ -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",

View File

@ -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({
<Input
ref={inputRef}
inputClassName="dropdown-input"
inputClassName={classnames(["dropdown-input"])}
onChange={onChange}
onFocus={onInternalFocus}
onBlur={onInternalBlur}

View File

@ -46,7 +46,7 @@
}
.dropdown-input:focus {
z-index: 2;
z-index: 11;
}
.dropdown-option {

View File

@ -82,9 +82,9 @@ type Props = {
name?: string;
min?: number;
min?: number | string;
max?: number;
max?: number | string;
};
export const Input = forwardRef<HTMLInputElement, Props>(

View File

@ -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<HTMLInputElement>;
};
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({
<div className="inputGroup-element">
<div className="inputGroup-inputContainer">
<Input
ref={inputRef}
id={id}
name={name}
label={label}

View File

@ -72,7 +72,7 @@ export function Modal({
<Backdrop open={open} onClose={onClose} removeScroll={true} />
<div className={classnames(["modal"], ["modal--open", open])}>
<div className="modal-body">{children}</div>
<div className="modal-body">{open && children}</div>
<div
className={classnames(

View File

@ -1,10 +1,13 @@
import { ReactNode } from "react";
import { Button } from "../Button/Button";
import "./placeholder.css";
import { SimpleText } from "../SimpleText/SimpleText";
type Props = {
title: string;
subtitle?: string;
message: string;
/**
@ -26,6 +29,7 @@ export function Placeholder({
title,
message,
Icon,
subtitle,
className = "",
onRetry,
}: Props) {
@ -33,6 +37,13 @@ export function Placeholder({
<div className={"placeholder " + className}>
<div className="placeholder-icon">{Icon}</div>
<b className="placeholder-title">{title}</b>
{subtitle && (
<div className="placeholder-subtitle">
<SimpleText variant="light">{subtitle}</SimpleText>
</div>
)}
<div className="placeholder-message">{message} </div>
{onRetry && (

View File

@ -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;
}

View File

@ -55,7 +55,7 @@ export function Select({
onMouseEnter,
onMouseLeave,
style,
className,
className = "",
defaultValue,
value,
}: Props) {

View File

@ -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.

View File

@ -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 {

View File

@ -71,7 +71,7 @@ export function Stepper({
state,
style,
dispatch,
className,
className = "",
backLabel = "Back",
nextLabel = "Next",
duration = 500,

View File

@ -37,6 +37,10 @@ export type StepperAction =
| {
type: "toggle-next";
isNextEnable: boolean;
}
| {
type: "toggle-back";
isBackEnable: boolean;
};
export type StepperBodyProps = {
@ -48,51 +52,27 @@ 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) => {
const reducer = () => (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,
};
}
@ -100,6 +80,7 @@ const reducer =
return {
...state,
progress: false,
step: action.step,
};
}
@ -109,12 +90,19 @@ const reducer =
isNextEnable: action.isNextEnable,
};
}
case "toggle-back": {
return {
...state,
isBackEnable: action.isBackEnable,
};
}
}
};
export function useStepperReducer(steps: number) {
export function useStepperReducer() {
const [state, dispatch] = useReducer<Reducer<StepperState, StepperAction>>(
reducer(steps),
reducer(),
{
step: 0,
isNextEnable: false,

View File

@ -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 {

View File

@ -18,7 +18,7 @@ type Props = {
className?: string;
};
export function Table({ headers, cells, className }: Props) {
export function Table({ headers, cells, className = "" }: Props) {
return (
<div className={`table-container ${className}`}>
<table className={"table"}>
@ -34,15 +34,11 @@ export function Table({ headers, cells, className }: Props) {
<tbody>
{cells.map((row, index) => (
<tr key={index} className="table-tbodyTr">
{headers.map((header, idx) => {
const cell = row[idx];
return (
{headers.map((header, idx) => (
<td key={header} className="table-tbodyTd">
{cell}
{row[idx]}
</td>
);
})}
))}
</tr>
))}
</tbody>