diff --git a/components/common/SelectTableField/index.tsx b/components/common/SelectTableField/index.tsx index aa85a7c6..e7fc9cd8 100644 --- a/components/common/SelectTableField/index.tsx +++ b/components/common/SelectTableField/index.tsx @@ -12,9 +12,11 @@ interface Props { open: boolean value?: string className?: string - imageAlt?: string - imageClass?: string - imageSrc?: string[] + image?: { + className?: String + alt?: string + src: string[] + } children: React.ReactNode onOpenChange: () => void onChange: (value: string) => void @@ -31,10 +33,8 @@ const SelectTableField = (props: Props) => { return ( diff --git a/components/common/TableField/index.module.scss b/components/common/TableField/index.module.scss index 100f9016..3028d939 100644 --- a/components/common/TableField/index.module.scss +++ b/components/common/TableField/index.module.scss @@ -1,4 +1,4 @@ -.TableField { +.field { align-items: center; display: grid; gap: $unit-2x; @@ -18,36 +18,36 @@ color: var(--accent-blue); } - &.Numeric .Right > .Input, - &.Numeric .Right > .Duration { + &.numeric .right > .input, + &.numeric .right > .duration { text-align: right; max-width: $unit-12x; width: $unit-12x; } - &.Numeric .Right > .Duration { + &.numeric .right > .Duration { justify-content: flex-end; box-sizing: border-box; } - &.Disabled { - &:hover .Left .Info h3 { + &.disabled { + &:hover .left .info h3 { color: var(--text-tertiary); } - .Left .Info h3 { + .left .info h3 { color: var(--text-tertiary); } } - .Left { + .left { align-items: center; display: flex; flex-direction: row; gap: $unit; width: 100%; - .Info { + .info { display: flex; flex-direction: column; flex-grow: 1; @@ -55,7 +55,7 @@ gap: $unit-half; } - .Image { + .image { display: none; .preview { @@ -90,7 +90,7 @@ } } - .Right { + .right { align-items: center; display: flex; flex-direction: row; @@ -99,12 +99,12 @@ width: 100%; @include breakpoint(phone) { - .Image { + .image { display: none; } } - .SelectTrigger { + .trigger { width: 100%; } } diff --git a/components/common/TableField/index.tsx b/components/common/TableField/index.tsx index f12eafd3..14ab72ad 100644 --- a/components/common/TableField/index.tsx +++ b/components/common/TableField/index.tsx @@ -5,21 +5,39 @@ interface Props { name: string label: string description?: string + image?: { + className?: String + alt?: string + src: string[] + } className?: string - imageAlt?: string - imageClass?: string - imageSrc?: string[] children: React.ReactNode } const TableField = (props: Props) => { + const classes = classNames( + { + [styles.field]: true, + }, + props.className?.split(' ').map((className) => styles[className]) + ) + const image = () => { - return props.imageSrc && props.imageSrc.length > 0 ? ( -
+ return props.image && props.image.src.length > 0 ? ( +
styles[className]) + )} + > {props.imageAlt}
) : ( @@ -28,17 +46,17 @@ const TableField = (props: Props) => { } return ( -
-
-
+
+
+

{props.label}

{props.description &&

{props.description}

}
-
{image()}
+
{image()}
-
-
{image()}
+
+
{image()}
{props.children}