From 8d171c27a2e33898b4d6d9f4fb20a33f776f45cc Mon Sep 17 00:00:00 2001 From: Guido Doumen Date: Mon, 16 Nov 2026 11:13:22 +0100 Subject: [PATCH 01/13] Add AttachmentChip molecule --- src/components/atoms/Buttons/Icon/index.jsx | 4 +- .../molecules/AttachmentChip/index.jsx | 95 +++++++++++++++++++ .../AttachmentChip/index.unit.test.jsx | 55 +++++++++++ .../molecules/AttachmentChip/stories.jsx | 23 +++++ src/components/molecules/index.jsx | 1 + 5 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 src/components/molecules/AttachmentChip/index.jsx create mode 100644 src/components/molecules/AttachmentChip/index.unit.test.jsx create mode 100644 src/components/molecules/AttachmentChip/stories.jsx diff --git a/src/components/atoms/Buttons/Icon/index.jsx b/src/components/atoms/Buttons/Icon/index.jsx index 5516172..04c76d8 100644 --- a/src/components/atoms/Buttons/Icon/index.jsx +++ b/src/components/atoms/Buttons/Icon/index.jsx @@ -35,7 +35,7 @@ const Label = styled(Text)` ` -export const Icon = ( {image,size,imageFormat='svg',color,margin,padding, label, id,backgroundHover, width,height, background,children,onClick, raw,logContext})=>{ +export const Icon = ( {image,size,imageFormat='svg',color,margin,padding, label, id,backgroundHover, width,height, background,children,onClick, raw,logContext,ariaLabel})=>{ const src = `${image}` const widthStr = width ? (typeof width ==='number' ? `${width}px`: width) : undefined @@ -91,7 +91,7 @@ export const Icon = ( {image,size,imageFormat='svg',color,margin,padding, label, return ( - + {children? renderChildren() : diff --git a/src/components/molecules/AttachmentChip/index.jsx b/src/components/molecules/AttachmentChip/index.jsx new file mode 100644 index 0000000..ebc4ef6 --- /dev/null +++ b/src/components/molecules/AttachmentChip/index.jsx @@ -0,0 +1,95 @@ +import React from 'react' +import styled from 'styled-components' +import { XIcon } from '@primer/octicons-react' +import { copyPropsExcluding } from '../../../utils/props' +import { Icon } from '../../atoms' + +const ACCENT = '#dd9933' +const HOVER = '#8dc100' + +const Chip = styled.div` + display: flex; + align-items: center; + align-self: flex-start; + box-sizing: border-box; + width: fit-content; + max-width: 100%; + height: 3.6vh; + min-height: 3.6vh; + border-radius: 1.8vh; + border: 1px solid ${ACCENT}; + background: rgba(221, 153, 51, 0.18); + margin: ${props => `1vh ${props.$margin ?? 0}`}; + padding: 0 0.3vh 0 1.2vh; + font-size: 1.8vh; + font-weight: 600; + color: ${props => props.theme?.dialogContent?.text ?? 'white'}; + + button { + color: inherit; + border-radius: 50%; + flex-shrink: 0; + float: none; + cursor: pointer; + } + button:hover { + background: none; + color: ${HOVER}; + } + button:focus-visible { + outline: 2px solid white; + outline-offset: 1px; + } + button svg { + width: 1.8vh; + height: 1.8vh; + } +` + +const Text = styled.span` + flex: 1 1 auto; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +` + +const Prefix = styled.span` + flex-shrink: 0; + margin-right: 0.6vh; +` + +const Close = (props) => { + const childProps = copyPropsExcluding(props, ['size', 'width', 'height']) + return +} + +/** + * Inline "