Skip to content

Commit fe1b5b2

Browse files
authored
fix: feedback ui heading post card (#77)
1 parent ce82f9c commit fe1b5b2

File tree

11 files changed

+51
-33
lines changed

11 files changed

+51
-33
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@eleven-labs/design-system",
33
"description": "Design System for Eleven Labs",
4-
"version": "0.32.0",
4+
"version": "0.33.0",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/eleven-labs/design-system.git"

src/components/Molecules/Cards/PostCard/PostCard.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,19 @@
2828
$this: &;
2929

3030
--background-color-post-card: white;
31-
--cover-size-square-mobile-post-card: 74px;
32-
--cover-size-square-desktop-post-card: 200px;
31+
--cover-size-square-mobile-post-card: 67px;
32+
--cover-size-square-desktop-post-card: 190px;
3333
--cover-height-horizontal-mobile-post-card: 130px;
3434
--cover-height-horizontal-medium-desktop-post-card: 175px;
3535
--cover-height-horizontal-large-desktop-post-card: 245px;
36+
--max-height-post-card: auto;
3637

3738

3839
position: relative;
3940
display: flex;
4041
background-color: var(--background-color-post-card);
4142
border-radius: #{map-get-strict($token-variables, 'radius', 's')};
43+
max-height: var(--max-height-post-card);
4244

4345
#{$this}__cover {
4446
width: 100%;
@@ -80,9 +82,13 @@
8082
}
8183

8284
&--side-image {
85+
--max-height-post-card: var(--cover-size-square-mobile-post-card);
86+
8387
flex-direction: row-reverse;
8488

8589
@include create-media-queries('md') {
90+
--max-height-post-card: var(--cover-size-square-desktop-post-card);
91+
8692
flex-direction: row;
8793
}
8894
#{$this}__cover {

src/components/Molecules/Cards/PostCard/PostCard.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import classNames from 'classnames';
22
import React from 'react';
33

44
import type { BoxProps, PictureProps } from '@/components';
5-
import { Box, Flex, Heading, Picture, Skeleton, Text } from '@/components';
5+
import { Box, Heading, Picture, Skeleton, Text } from '@/components';
66
import { PostMetadata } from '@/components';
77
import type { ComponentPropsWithoutRef } from '@/types';
88

@@ -49,18 +49,16 @@ export const PostCard: React.FC<PostCardProps> = ({
4949
})}
5050
>
5151
<Skeleton isLoading={isLoading}>
52-
<Picture {...cover} img={{ className: 'post-card__cover', ...cover?.img }} />
52+
<Picture {...cover} img={{ ...cover?.img, className: 'post-card__cover' }} />
5353
</Skeleton>
54-
<Flex
55-
flexDirection="column"
56-
justifyContent="between"
57-
my={{ xs: 's', md: 'm' }}
58-
pl={{ xs: 's', md: 'm' }}
59-
pr={{ xs: 'xs', md: 'm' }}
60-
flex="1"
61-
>
54+
<Box my={{ xs: 's', md: 'm' }} pl={{ xs: 's', md: 'm' }} pr={{ xs: 'xs', md: 'm' }} flex="1">
6255
<Skeleton isLoading={isLoading}>
63-
<Heading as="h2" size="xs" lineClamp={2} className="post-card__heading">
56+
<Heading
57+
as="h2"
58+
size="xs"
59+
lineClamp={{ xs: variant === 'highlight-dark' ? 2 : 4, md: variant === 'highlight-light' ? 3 : 2 }}
60+
className="post-card__heading"
61+
>
6462
<Text as="a" {...link} size="m" data-internal-link="post" className="post-card__link">
6563
{title}
6664
</Text>
@@ -89,11 +87,11 @@ export const PostCard: React.FC<PostCardProps> = ({
8987
/>
9088
{variant !== 'highlight-dark' && (
9189
<Skeleton isLoading={isLoading}>
92-
<Text mt="xs" size="s" hiddenBelow="md" lineClamp={2} className="post-card__excerpt">
90+
<Text mt="xs" size="s" hiddenBelow="md" lineClamp={{ xs: 4, md: 2 }} className="post-card__excerpt">
9391
{excerpt}
9492
</Text>
9593
</Skeleton>
9694
)}
97-
</Flex>
95+
</Box>
9896
</Box>
9997
);

src/components/Molecules/PostMetadata/PostMetadata.stories.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ WithVariantSecondary.args = {
2626
{
2727
username: 'jdoe',
2828
name: 'J. Doe',
29+
link: {
30+
href: '/fr/authors/jdoe',
31+
},
2932
},
3033
{
3134
username: 'jdupont',
3235
name: 'J. Dupont',
36+
link: {
37+
href: '/fr/authors/jdupont',
38+
},
3339
},
3440
],
3541
variant: 'secondary',

src/components/Molecules/PostMetadata/PostMetadata.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import classNames from 'classnames';
22
import React, { Fragment } from 'react';
33

4-
import { Flex, Icon, Skeleton, Text } from '@/components';
5-
import type { SpacingSystemProps } from '@/types';
4+
import { Flex, Icon, Link, Skeleton, Text } from '@/components';
5+
import type { ComponentPropsWithoutRef, SpacingSystemProps } from '@/types';
66

77
import './PostMetadata.scss';
88

@@ -16,6 +16,7 @@ export interface PostMetadataProps extends SpacingSystemProps {
1616
authors?: {
1717
username: string;
1818
name: string;
19+
link?: ComponentPropsWithoutRef<'a'>;
1920
}[];
2021
isLoading?: boolean;
2122
displayedFields?: ('date' | 'readingTime' | 'authors')[];
@@ -73,15 +74,15 @@ export const PostMetadata: React.FC<PostMetadataProps> = ({
7374
style={{ minWidth: 50, minHeight: 16 }}
7475
>
7576
{authors && (
76-
<>
77+
<Flex alignContent="center" alignItems="center" gap="xxs" className="post-metadata__authors">
7778
{variant === 'secondary' && <Icon name="person" size="24px" color="light-grey" />}
78-
{authors.map(({ username, name }, authorIndex) => (
79+
{authors.map(({ username, name, link }, authorIndex) => (
7980
<Fragment key={username}>
80-
<Text as="span">{name}</Text>
81+
{link ? <Link {...link}>{name}</Link> : <Text as="span">{name}</Text>}
8182
{authorIndex !== authors.length - 1 && <Text as="span">{' & '}</Text>}
8283
</Fragment>
8384
))}
84-
</>
85+
</Flex>
8586
)}
8687
</Skeleton>
8788
);

src/components/Organisms/Autocomplete/AutocompleteResult/AutocompleteResult.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const AutocompleteResult = polyRef<'div', AutocompleteResultProps>(
6767
size="s"
6868
text={title}
6969
textQuery={searchValue}
70-
lineClamp={2}
70+
lineClamp={{ xs: 4, md: 2 }}
7171
className="autocomplete-result__link"
7272
/>
7373
<PostMetadata mt="xxs-3" date={date} authors={authors} displayedFields={['date', 'authors']} />

src/helpers/systemPropsHelper/typographySystemClassName.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classNames from 'classnames';
22

33
import { classNamesWithModifiers } from '@/helpers/systemPropsHelper/classNamesWithModifiers';
4-
import type { MediaQueryType, TextAlignType, TypographySystemProps } from '@/types';
4+
import type { LineClampType, MediaQueryType, TextAlignType, TypographySystemProps } from '@/types';
55

66
export const typographySystemClassName = <TProps extends TypographySystemProps>({
77
textAlign,
@@ -20,6 +20,9 @@ export const typographySystemClassName = <TProps extends TypographySystemProps>(
2020
[`text-underline`]: props.underline,
2121
[`text-italic`]: props.italic,
2222
[`text-${textSize}`]: textSize,
23-
[`line-clamp-${lineClamp}`]: lineClamp,
24-
}
23+
},
24+
...classNamesWithModifiers<MediaQueryType, LineClampType>({
25+
propValue: lineClamp,
26+
className: 'line-clamp',
27+
})
2528
);

src/pages/PostPage/PostPage.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $headings-by-compoent-variant-name: (
3737
border-radius: #{map-get-strict($token-variables, 'radius', 'xs')};
3838

3939
@include create-media-queries('md') {
40-
--height-cover-post-page: 335px;
40+
--height-cover-post-page: 330px;
4141
}
4242
}
4343

src/styles/utilities/_typography.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ $text-config: map.get($token-variables, 'typography', 'text');
8080
@include component('heading', $heading-config);
8181
@include text-component($text-config);
8282

83-
@for $number-of-lines from 1 to 4 {
84-
.line-clamp-#{$number-of-lines} {
85-
@include line-clamp($number-of-lines);
83+
@each $breakpoint-name, $breakpoint-value in map.get($token-variables, 'breakpoint') {
84+
@include create-media-queries($breakpoint-name) {
85+
@for $number-of-lines from 1 to 4 {
86+
.line-clamp-#{$number-of-lines}\@#{$breakpoint-name} {
87+
@include line-clamp($number-of-lines);
88+
}
89+
}
8690
}
8791
}

0 commit comments

Comments
 (0)