From 54390cf86196ae41c5b59f8b465adf9cef14df2c Mon Sep 17 00:00:00 2001 From: FELIPE BELGINE Date: Fri, 18 Oct 2024 10:27:47 -0400 Subject: [PATCH] refactor: truncate texts and add elipses, and adjust sb examples --- .../PromptPreview/PromptPreview.stories.tsx | 11 ++++-- .../molecules/PromptPreviewSection/index.tsx | 37 ++++++++++++++----- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/opentrons-ai-client/src/molecules/PromptPreview/PromptPreview.stories.tsx b/opentrons-ai-client/src/molecules/PromptPreview/PromptPreview.stories.tsx index a900455c4ca..79e7b822dcc 100644 --- a/opentrons-ai-client/src/molecules/PromptPreview/PromptPreview.stories.tsx +++ b/opentrons-ai-client/src/molecules/PromptPreview/PromptPreview.stories.tsx @@ -35,7 +35,7 @@ export const PromptPreviewExample: Story = { title: 'Application', items: [ 'Cherrypicking', - 'I have a Chlorine Reagent Set (Total), Ultra Low Range...', + 'I have a Chlorine Reagent Set (Total), Ultra Low Range', ], }, { @@ -59,13 +59,16 @@ export const PromptPreviewExample: Story = { 'Opentrons 96 Well Plate', 'Thermocycler GEN2', 'Opentrons 96 Deep Well Plate', - 'Liquid 1: These are my samples, the...', - 'Liquid 2: This is the reagent in my ...', + 'Liquid 1: In commodo lectus nec erat commodo blandit. Etiam leo dui, porttitor vel imperdiet sed, tristique nec nisl. Maecenas pulvinar sapien quis sodales imperdiet.', + 'Liquid 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit.', ], }, { title: 'Steps', - items: ['Fill the first column of a Elisa...'], + items: [ + 'Fill the first column of a Elisa plate with 100 uL of Liquid 1', + 'Fill the second column of a Elisa plate with 100 uL of Liquid 2', + ], }, ], }, diff --git a/opentrons-ai-client/src/molecules/PromptPreviewSection/index.tsx b/opentrons-ai-client/src/molecules/PromptPreviewSection/index.tsx index e42d66d5da9..91dfabb75ec 100644 --- a/opentrons-ai-client/src/molecules/PromptPreviewSection/index.tsx +++ b/opentrons-ai-client/src/molecules/PromptPreviewSection/index.tsx @@ -2,7 +2,6 @@ import styled from 'styled-components' import { Flex, StyledText, - COLORS, Tag, DIRECTION_COLUMN, WRAP, @@ -23,10 +22,27 @@ const SectionHeading = styled(StyledText)` margin-bottom: ${SPACING.spacing8}; ` -const TagGrid = styled(Flex)` +const TagsContainer = styled(Flex)` grid-gap: ${SPACING.spacing4}; flex-wrap: ${WRAP}; - color: ${COLORS.grey60}; + justify-content: flex-start; + width: 100%; +` + +const TagItemWrapper = styled(Flex)` + width: auto; + white-space: nowrap; + overflow: hidden; + max-width: 35%; + + & > div { + overflow: hidden; + + > p { + overflow: hidden; + text-overflow: ellipsis; + } + } ` export function PromptPreviewSection({ @@ -36,13 +52,16 @@ export function PromptPreviewSection({ return ( {title} - - {items.map((item: string, index: number) => - item.trim() === '' ? null : ( - - ) + + {items.map( + (item: string, index: number) => + item.trim() !== '' && ( + + + + ) )} - + ) }