Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
fix: button text overflow (#117)
Browse files Browse the repository at this point in the history
Fixes button labels overflow 
Fixes card titles wrapping behaviour
  • Loading branch information
ninabondar authored Mar 22, 2024
1 parent 2af09ee commit d7984ed
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ nyc_coverage*

.env.*

build-storybook.log
build-storybook.log
storybook-static/
5 changes: 4 additions & 1 deletion packages/react-chat/src/components/Button/Primary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import { ButtonVariant } from './constants';
import { Container, tag } from './styled';

export const PrimaryButton = styled(tag(Container, ButtonVariant.PRIMARY), {
height: '$md',
minHeight: '$md',
color: '$white',
trans: ['background-color'],
padding: '10px 14px',
boxSizing: 'border-box',
whiteSpace: 'break-spaces',

variants: {
type: {
Expand Down
11 changes: 11 additions & 0 deletions packages/react-chat/src/components/Card/Card.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ export const Actionable: Story = {
},
};

export const WithLongLabels: Story = {
args: {
...WithImage.args,
actions: [
{ request: {} as any, name: 'First Button with a very long long long wrapping label' },
{ request: {} as any, name: 'Second Button with a shorter text' },
{ request: {} as any, name: 'Third button, also with a shorter text' },
],
},
};

export const WithLongTitle: Story = {
args: {
...WithImage.args,
Expand Down
1 change: 1 addition & 0 deletions packages/react-chat/src/components/Card/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const Header = styled(tag('h3', 'header'), {
color: '$black',
wordBreak: 'break-word',
maxWidth: '100%',
whiteSpace: 'break-spaces',
});

export const Description = styled(tag('p', 'description'), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ const MULTIPLE_CARDS = [
image: IMAGE,
},
{
title: 'Third Card',
title: 'Third Card with a long title that wraps',
description: 'Lorem ipsum dolor sit amet consectetur adipisicing elit.',
actions: [
{ request: {} as any, name: 'Fourth Button' },
{ request: {} as any, name: 'Fourth Button with a long label that wraps' },
{ request: {} as any, name: 'Fifth Button' },
],
},
Expand Down

0 comments on commit d7984ed

Please sign in to comment.