diff --git a/src/front/Components/DesignSystem/Form/BaseField.tsx b/src/front/Components/DesignSystem/Form/BaseField.tsx index 08be103f..2982bc93 100644 --- a/src/front/Components/DesignSystem/Form/BaseField.tsx +++ b/src/front/Components/DesignSystem/Form/BaseField.tsx @@ -15,6 +15,7 @@ export type IProps = { disableValidation?: boolean; validationError?: ValidationError; disabled?: boolean; + label?: string; }; type IState = { diff --git a/src/front/Components/DesignSystem/Form/NewFields/NewTextField/classes.module.scss b/src/front/Components/DesignSystem/Form/NewFields/NewTextField/classes.module.scss new file mode 100644 index 00000000..5a5d2ef1 --- /dev/null +++ b/src/front/Components/DesignSystem/Form/NewFields/NewTextField/classes.module.scss @@ -0,0 +1,112 @@ +@import "@Themes/constants.scss"; + +.root { + position: relative; + + &[data-is-disabled="true"] { + opacity: var(--opacity-disabled, 0.3); + .input-container { + cursor: not-allowed; + border: 1px solid var(--input-main-border-default, #d7dce0); + &::placeholder { + background: var(--input-background, #fff); + } + + &:hover { + border: 1px solid var(--input-main-border-default, #d7dce0); + } + + .input { + cursor: not-allowed; + } + } + } + + .label { + padding: 0px var(--spacing-2, 16px); + } + + .input-container { + display: flex; + padding: var(--spacing-2, 16px) var(--spacing-sm, 8px); + align-items: center; + gap: var(--spacing-2, 16px); + + border-radius: var(--input-radius, 0px); + border: 1px solid var(--input-main-border-default, #d7dce0); + background: var(--input-background, #fff); + + &:hover { + border: 1px solid var(--input-main-border-hovered, #b4bec5); + } + + &:not([data-value=""]) { + border: 1px solid var(--input-main-border-filled, #6d7e8a); + .input { + font-weight: var(--font-text-weight-semibold, 600); + } + } + + &[data-is-errored="true"] { + border: 1px solid var(--input-error, #dc2625); + } + + &:focus, + &:focus-within, + &:focus-visible { + border: 1px solid var(--input-main-border-focused, #005bcb); + .input { + font-weight: var(--font-text-weight-semibold, 600); + } + } + + .input { + display: flex; + padding: 0px var(--spacing-2, 16px); + + align-items: center; + gap: 8px; + + flex: 1 0 0; + border: none; + + &::placeholder { + color: var(--input-placeholder-empty, #6d7e8a); + /* text/md/regular */ + font-family: var(--font-text-family, Poppins); + font-size: 16px; + font-style: normal; + font-weight: var(--font-text-weight-regular, 400); + line-height: normal; + letter-spacing: 0.08px; + } + + &[type="number"] { + &::-webkit-inner-spin-button, + &::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; + } + + /* For Chrome, Safari, and Opera */ + &::-webkit-inner-spin-button, + &::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; + } + + /* For IE 10+ */ + &::-ms-inner-spin-button, + &::-ms-outer-spin-button { + display: none; + } + } + } + } + + .copy-icon { + cursor: pointer; + height: 24px; + width: 24px; + } +} diff --git a/src/front/Components/DesignSystem/Form/NewFields/NewTextField/index.tsx b/src/front/Components/DesignSystem/Form/NewFields/NewTextField/index.tsx new file mode 100644 index 00000000..ab14094f --- /dev/null +++ b/src/front/Components/DesignSystem/Form/NewFields/NewTextField/index.tsx @@ -0,0 +1,63 @@ +import React from "react"; +import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; +import { ReactNode } from "react"; +import CopyIcon from "@Assets/Icons/copy.svg"; +import BaseField, { IProps as IBaseFieldProps } from "../../BaseField"; +import classes from "./classes.module.scss"; +import classnames from "classnames"; +import Image from "next/image"; + +export type IProps = IBaseFieldProps & { + canCopy?: boolean; + password?: boolean; +}; + +export default class NewTextField extends BaseField { + constructor(props: IProps) { + super(props); + this.state = this.getDefaultState(); + } + + public override render(): ReactNode { + const value = this.state.value ?? ""; + console.log(this.hasError()); + return ( + +
+ +
+ {this.hasError() &&
{this.renderErrors()}
} +
+ ); + } + + private onCopyClick = (): void => { + if (this.props.canCopy) { + navigator.clipboard.writeText(this.state.value ?? ""); + } + }; +} diff --git a/src/front/Components/DesignSystem/Typography/index.tsx b/src/front/Components/DesignSystem/Typography/index.tsx index 86dd26dc..44fa4c03 100644 --- a/src/front/Components/DesignSystem/Typography/index.tsx +++ b/src/front/Components/DesignSystem/Typography/index.tsx @@ -144,6 +144,8 @@ export enum ETypoColor { TABS_CONTRAST_DEFAULT = "--tabs-contrast-default", TABS_CONTRAST_ACTIVATED = "--tabs-contrast-actived", + + INPUT_LABEL = "--input-label", } export default function Typography(props: IProps) { diff --git a/src/front/Components/Layouts/DesignSystem/index.tsx b/src/front/Components/Layouts/DesignSystem/index.tsx index 599555c1..a9d86a3a 100644 --- a/src/front/Components/Layouts/DesignSystem/index.tsx +++ b/src/front/Components/Layouts/DesignSystem/index.tsx @@ -13,6 +13,8 @@ import classes from "./classes.module.scss"; import useOpenable from "@Front/Hooks/useOpenable"; import Modal from "@Front/Components/DesignSystem/Modal"; import IconButton, { EIconButtonVariant } from "@Front/Components/DesignSystem/IconButton"; +import NewTextField from "@Front/Components/DesignSystem/Form/NewFields/NewTextField"; +import Form from "@Front/Components/DesignSystem/Form"; export default function DesignSystem() { const { isOpen, open, close } = useOpenable(); @@ -64,6 +66,14 @@ export default function DesignSystem() {
+ Inputs +
+ + + + + + Modal