From faf5724d5fe1c3e0cdfe59912cc41e04f03b514c Mon Sep 17 00:00:00 2001 From: Vineeth Asok Kumar Date: Fri, 20 Oct 2023 15:12:14 +0200 Subject: [PATCH] Fix select value (#183) * Fix select ellipsis issue * Fix Badge alignment * Fix Badge styling --- src/components/Badge/Badge.tsx | 40 +++++++++---------- src/components/Select/MultiSelectValue.tsx | 11 ++++- src/components/Select/common/SelectStyled.tsx | 3 +- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/components/Badge/Badge.tsx b/src/components/Badge/Badge.tsx index e5632aaf..d8cf0eb2 100644 --- a/src/components/Badge/Badge.tsx +++ b/src/components/Badge/Badge.tsx @@ -2,6 +2,7 @@ import styled from "styled-components"; import { HorizontalDirection, Icon, IconName } from "@/components"; import { HTMLAttributes, MouseEvent, ReactNode } from "react"; import { EllipsisContainer } from "../commonElement"; +import IconWrapper from "../IconWrapper/IconWrapper"; export type BadgeState = | "default" | "success" @@ -47,6 +48,8 @@ const Content = styled.div<{ $state?: BadgeState; $size?: BadgeSize }>` display: inline-flex; align-items: center; gap: ${({ $size = "md", theme }) => theme.click.badge.space[$size].gap}; + max-width: 100%; + justify-content: flex-start; `; const SvgContainer = styled.svg<{ $state?: BadgeState; $size?: BadgeSize }>` @@ -58,13 +61,15 @@ const SvgContainer = styled.svg<{ $state?: BadgeState; $size?: BadgeSize }>` `; const BadgeContent = styled(EllipsisContainer)<{ $state?: BadgeState; - $size?: BadgeSize; + size?: BadgeSize; }>` + width: auto; + overflow: hidden; svg { - ${({ $state = "default", $size = "md", theme }) => ` + ${({ $state = "default", size = "md", theme }) => ` color: ${theme.click.badge.color.text[$state]}; - height: ${theme.click.badge.icon[$size].size.height}; - width: ${theme.click.badge.icon[$size].size.width}; + height: ${theme.click.badge.icon[size].size.height}; + width: ${theme.click.badge.icon[size].size.width}; gap: inherit; `} } @@ -88,24 +93,15 @@ export const Badge = ({ {...props} > - {icon && iconDir === "start" && ( - - )} - {text} - {icon && iconDir === "end" && ( - - )} - + + {text} + {dismissible && ( ; valueNode: Map; @@ -91,7 +99,8 @@ export const MultiSelectValue = ({ } as DismissibleBadge; } return ( - `