Skip to content

Commit

Permalink
Merge branch 'main' into feature/picker-responsive-group-headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbork authored Dec 10, 2024
2 parents 287b3d6 + 7ed07d2 commit 6912434
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 56 deletions.
18 changes: 6 additions & 12 deletions packages/react-components/src/components/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';

import { Meta } from '@storybook/react';

import image from '../../stories/assets/avatar.jpg';
import { StoryDescriptor } from '../../stories/components/StoryDescriptor';

import { Avatar, AvatarProps } from './Avatar';
Expand All @@ -16,8 +17,6 @@ export const Default = (args: AvatarProps): React.ReactElement => (
<Avatar {...args} />
);

const defaultImage =
'https://cdn-labs.livechat-files.com/api/file/lc/img/100019504/df59da4b5b0cdb6030efb08787fd255d.jpg';
const defaultName = 'John Doe';

Default.args = {
Expand All @@ -28,7 +27,7 @@ Default.args = {
export const Types = (): React.ReactElement => (
<>
<StoryDescriptor title="Image">
<Avatar type="image" src={defaultImage} alt="User avatar" />
<Avatar type="image" src={image} alt="User avatar" />
</StoryDescriptor>
<StoryDescriptor title="Text">
<Avatar type="text" text={'Support Heroes'} />
Expand Down Expand Up @@ -100,10 +99,10 @@ export const FallbackAvatar = (): React.ReactElement => (
export const Rim = (): React.ReactElement => (
<>
<StoryDescriptor title="Rim">
<Avatar withRim type="image" src={defaultImage} />
<Avatar withRim type="image" src={image} />
</StoryDescriptor>{' '}
<StoryDescriptor title="Rim with status">
<Avatar withRim status="available" type="image" src={defaultImage} />
<Avatar withRim status="available" type="image" src={image} />
</StoryDescriptor>
</>
);
Expand All @@ -113,12 +112,7 @@ export const SizesWithStatus = (): React.ReactElement => {
<>
{AvatarSizes.map((size) => (
<StoryDescriptor title={size} key={size}>
<Avatar
type="image"
src={defaultImage}
size={size}
status="available"
/>
<Avatar type="image" src={image} size={size} status="available" />
<Avatar
type="text"
text={defaultName}
Expand All @@ -137,7 +131,7 @@ export const SizesWithRim = (): React.ReactElement => {
<>
{AvatarSizes.map((size) => (
<StoryDescriptor title={size} key={size} gap="12px">
<Avatar type="image" src={defaultImage} size={size} withRim />
<Avatar type="image" src={image} size={size} withRim />
<Avatar
type="text"
text={defaultName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ $base-class: 'card';

&__image {
border-radius: 4px;
background-color: var(--surface-basic-disabled);
width: 48px;
height: 48px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react';
import { action } from '@storybook/addon-actions';
import { Meta } from '@storybook/react';

import image from '../../stories/assets/folder.svg';
import { Card, CardProps } from '../Card';

export default {
Expand All @@ -24,7 +25,7 @@ export const Default = (args: CardProps): React.ReactElement => (

Default.args = {
title: 'Card title',
src: 'https://via.placeholder.com/100',
src: image,
alt: 'Image description',
children:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore',
Expand All @@ -35,7 +36,7 @@ export const Expandable = (): React.ReactElement => (
<Card
title="Expandable card"
description="Click show more to expand"
src="https://via.placeholder.com/100"
src={image}
expandableContent="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore"
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
Expand All @@ -47,7 +48,7 @@ export const WithButtons = (): React.ReactElement => (
<Card
title="Expandable card"
description="Click show more to expand"
src="https://via.placeholder.com/100"
src={image}
buttonsOptions={[
{
kind: 'secondary',
Expand All @@ -70,7 +71,7 @@ export const ExpandableWithButtons = (): React.ReactElement => (
<Card
title="Expandable card"
description="Click show more to expand"
src="https://via.placeholder.com/100"
src={image}
expandableContent="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore"
buttonsOptions={[
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { action } from '@storybook/addon-actions';
import { Meta, StoryObj } from '@storybook/react';

import image from '../../stories/assets/avatar.jpg';

import { InviteAgents } from './InviteAgents';

const meta: Meta<typeof InviteAgents> = {
Expand Down Expand Up @@ -37,21 +39,21 @@ const mockAgents = [
name: 'Alice Johnson 2',
email: 'alic2@example.com',
status: 'available' as const,
avatar: 'https://via.placeholder.com/150',
avatar: image,
isBot: false,
},
{
name: 'Bob Smith',
email: 'bob3@example.com',
status: 'unavailable' as const,
avatar: 'https://via.placeholder.com/150',
avatar: image,
isBot: false,
},
...[...Array(10)].map((_, index) => ({
name: `Unknown Agent ${index}`,
email: `unknown${index}@example.com`,
status: 'available' as const,
avatar: 'https://via.placeholder.com/150',
avatar: image,
isBot: index % 2 === 0,
})),
];
Expand Down
41 changes: 9 additions & 32 deletions packages/react-components/src/components/Picker/Picker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';

import { Meta, StoryFn } from '@storybook/react';

import image from '../../stories/assets/avatar.jpg';
import { StoryDescriptor } from '../../stories/components/StoryDescriptor';
import { customHeightForChromatic } from '../../utils/chromatic-story-helpers';
import noop from '../../utils/noop';
Expand Down Expand Up @@ -171,10 +172,7 @@ export const PickerWithOptionsAsCustomElements = (): React.ReactElement => (
customElement: {
listItemBody: (
<CustomPickerOption>
<img
className="image"
src="https://avatars2.githubusercontent.com/u/29309941?s=88&v=4"
/>
<img className="image" src={image} />
<div>
<div className="title">Example custom element one</div>
<div className="description">Example custom element</div>
Expand All @@ -183,10 +181,7 @@ export const PickerWithOptionsAsCustomElements = (): React.ReactElement => (
),
selectedItemBody: (
<CustomPickerOption>
<img
className="image selected"
src="https://avatars2.githubusercontent.com/u/29309941?s=88&v=4"
/>
<img className="image selected" src={image} />
<div className="title selected">
Example custom element one
</div>
Expand All @@ -200,10 +195,7 @@ export const PickerWithOptionsAsCustomElements = (): React.ReactElement => (
customElement: {
listItemBody: (
<CustomPickerOption>
<img
className="image"
src="https://avatars2.githubusercontent.com/u/29309941?s=88&v=4"
/>
<img className="image" src={image} />
<div>
<div className="title">Example custom element two</div>
<div className="description">Example custom element</div>
Expand All @@ -212,10 +204,7 @@ export const PickerWithOptionsAsCustomElements = (): React.ReactElement => (
),
selectedItemBody: (
<CustomPickerOption>
<img
className="image selected"
src="https://avatars2.githubusercontent.com/u/29309941?s=88&v=4"
/>
<img className="image selected" src={image} />
<div className="title selected">
Example custom element two
</div>
Expand All @@ -236,10 +225,7 @@ export const PickerWithOptionsAsCustomElements = (): React.ReactElement => (
customElement: {
listItemBody: (
<CustomPickerOption>
<img
className="image"
src="https://avatars2.githubusercontent.com/u/29309941?s=88&v=4"
/>
<img className="image" src={image} />
<div>
<div className="title">Example custom element one</div>
<div className="description">Example custom element</div>
Expand All @@ -248,10 +234,7 @@ export const PickerWithOptionsAsCustomElements = (): React.ReactElement => (
),
selectedItemBody: (
<CustomPickerOption>
<img
className="image selected"
src="https://avatars2.githubusercontent.com/u/29309941?s=88&v=4"
/>
<img className="image selected" src={image} />
<div className="title selected">Example element one</div>
</CustomPickerOption>
),
Expand All @@ -263,10 +246,7 @@ export const PickerWithOptionsAsCustomElements = (): React.ReactElement => (
customElement: {
listItemBody: (
<CustomPickerOption>
<img
className="image"
src="https://avatars2.githubusercontent.com/u/29309941?s=88&v=4"
/>
<img className="image" src={image} />
<div>
<div className="title">Example custom element two</div>
<div className="description">Example custom element</div>
Expand All @@ -275,10 +255,7 @@ export const PickerWithOptionsAsCustomElements = (): React.ReactElement => (
),
selectedItemBody: (
<CustomPickerOption>
<img
className="image selected"
src="https://avatars2.githubusercontent.com/u/29309941?s=88&v=4"
/>
<img className="image selected" src={image} />
<div className="title selected">Example element two</div>
</CustomPickerOption>
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DayMode } from '@livechat/design-system-icons';

import image from '../../stories/assets/avatar.jpg';
import { Icon } from '../Icon';
import { TagKind } from '../Tag';

Expand Down Expand Up @@ -87,7 +88,7 @@ export const DEFAULT_MORE_PICKER_OPTIONS: IPickerListItem[] = [
{
key: 'four',
name: 'Option with avatar',
avatarSrc: 'https://avatars2.githubusercontent.com/u/29309941?s=88&v=4',
avatarSrc: image,
},
];

Expand Down
5 changes: 2 additions & 3 deletions packages/react-components/src/components/Tag/Tag.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react';
import * as TablerIcons from '@livechat/design-system-icons';
import { Meta } from '@storybook/react';

import image from '../../stories/assets/avatar.jpg';
import { StoryDescriptor } from '../../stories/components/StoryDescriptor';
import noop from '../../utils/noop';
import { Icon } from '../Icon';
Expand All @@ -15,9 +16,7 @@ const exampleIcon = <Icon source={TablerIcons.Smiles} size="small" />;
const exampleAvatar = (
<img
style={{ borderRadius: '50%', width: '20px', height: '20px' }}
src={
'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200'
}
src={image}
alt="tag-avatar"
data-testid="lc-tag-avatar"
/>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/react-components/src/stories/assets/folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6912434

Please sign in to comment.