From d5fcd8ddec436b1fadcc901a435917cff4e51abb Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Wed, 21 Sep 2022 16:26:11 +0200 Subject: [PATCH] Fix layout issues and add more test examples --- .../src/components/text-field.stories.tsx | 71 ++++++++++++++----- .../src/components/text-field.tsx | 10 ++- 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/packages/design-system/src/components/text-field.stories.tsx b/packages/design-system/src/components/text-field.stories.tsx index 62a7289731..752d5acb2e 100644 --- a/packages/design-system/src/components/text-field.stories.tsx +++ b/packages/design-system/src/components/text-field.stories.tsx @@ -6,6 +6,8 @@ import { Flex } from "./flex"; import { IconButton } from "./icon-button"; import { TextField } from "./text-field"; import { Box } from "./box"; +import { Grid } from "./grid"; +import { Text } from "./text"; export default { component: TextField, @@ -100,26 +102,59 @@ export const PrefixSuffix: ComponentStory = () => { export const Layout: ComponentStory = () => { return ( - - } - suffix={ - - - - } + <> + + } + suffix={ + + + + } + css={{ + flexGrow: 1, + maxWidth: "25%", + }} + /> + Content + + + + - Content - - + > + + + This is a label + + + + } + /> + + + + This is a label + + + + + ); }; diff --git a/packages/design-system/src/components/text-field.tsx b/packages/design-system/src/components/text-field.tsx index d411e0e0ff..b539bd39dd 100644 --- a/packages/design-system/src/components/text-field.tsx +++ b/packages/design-system/src/components/text-field.tsx @@ -14,6 +14,9 @@ const InputBase = styled("input", { padding: "0", flexGrow: 1, flexShrink: 1, + minWidth: 0, + width: "100%", + textOverflow: "ellipsis", outline: "none", WebkitTapHighlightColor: "rgba(0,0,0,0)", @@ -21,12 +24,6 @@ const InputBase = styled("input", { // DOM order reflects focus path and visually we use order to put them into the correct visual order. order: 1, - "&::before": { - boxSizing: "border-box", - }, - "&::after": { - boxSizing: "border-box", - }, "&:-webkit-autofill": { boxShadow: "inset 0 0 0 1px $colors$blue6, inset 0 0 0 100px $colors$blue3", }, @@ -51,6 +48,7 @@ const InputBase = styled("input", { fontFamily: "$untitled", color: "$hiContrast", }, + "&::placeholder": { color: "$slate9", },