Skip to content

Commit

Permalink
fix: post cover
Browse files Browse the repository at this point in the history
  • Loading branch information
fpasquet committed Jan 31, 2024
1 parent 6e8efe5 commit dc8da68
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 121 deletions.
1 change: 1 addition & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"ignoreFiles": [
"src/styles/_fonts.scss",
"src/styles/_token-custom-properties.scss",
"src/styles/_token-custom-properties-desktop.scss",
"src/styles/abstracts/variables/_token-variables.scss",
"src/styles/abstracts/variables/_variables.scss"
]
Expand Down
14 changes: 9 additions & 5 deletions bin/build-design-tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import StyleDictionary from 'style-dictionary';
import './formats/register';
import './transforms/register';


const defaultFilter = (token: TransformedToken) => token.type !== 'scale';

const filterExcludesCategories = (token: TransformedToken, categories: string[]): boolean =>
token?.attributes?.category ? !categories.includes(token.attributes.category) : false;

Expand All @@ -19,7 +22,7 @@ const sdConfigs: Config[] = [
files: [
{
format: 'css/variables',
filter: (token): boolean => filterExcludesCategories(token, ['asset', 'breakpoint']),
filter: (token): boolean => defaultFilter(token) && filterExcludesCategories(token, ['asset', 'breakpoint']),
destination: '_token-custom-properties.scss',
},
],
Expand All @@ -30,7 +33,7 @@ const sdConfigs: Config[] = [
files: [
{
format: 'scss/map-deep',
filter: (token): boolean => token?.attributes?.category === 'color',
filter: (token): boolean => defaultFilter(token) && token?.attributes?.category === 'color',
destination: 'abstracts/variables/_variables.scss',
mapName: 'variables',
} as File,
Expand All @@ -42,7 +45,7 @@ const sdConfigs: Config[] = [
files: [
{
format: 'scss/map-deep-with-css-variables',
filter: (token): boolean => filterExcludesCategories(token, ['asset']),
filter: (token): boolean => defaultFilter(token) && filterExcludesCategories(token, ['asset']),
destination: 'abstracts/variables/_token-variables.scss',
},
],
Expand All @@ -56,6 +59,7 @@ const sdConfigs: Config[] = [
files: [
{
format: 'typescript/object',
filter: defaultFilter,
destination: 'constants/tokenVariables.ts',
},
],
Expand All @@ -72,7 +76,7 @@ const sdConfigs: Config[] = [
files: [
{
format: 'css/variables',
filter: (token): boolean => filterExcludesCategories(token, ['asset', 'breakpoint']) && token.filePath.indexOf(`.desktop`) > -1,
filter: (token): boolean => defaultFilter(token) && filterExcludesCategories(token, ['asset', 'breakpoint']),
destination: '_token-custom-properties-desktop.scss',
options: {
mediaQuery: 'md',
Expand All @@ -86,7 +90,7 @@ const sdConfigs: Config[] = [
files: [
{
format: 'typescript/object',
filter: (token): boolean => token.filePath.indexOf(`.desktop`) > -1,
filter: defaultFilter,
destination: 'constants/tokenVariablesDesktop.ts',
},
],
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@eleven-labs/design-system",
"description": "Design System for Eleven Labs",
"version": "0.29.0",
"version": "0.30.0",
"repository": {
"type": "git",
"url": "https://github.com/eleven-labs/design-system.git"
Expand Down
4 changes: 3 additions & 1 deletion src/components/Atoms/Breadcrumb/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import classNames from 'classnames';
import React, { Fragment } from 'react';

import { Flex, Link, Text } from '@/components';
Expand All @@ -7,6 +8,7 @@ import './Breadcrumb.scss';

export interface BreadcrumbProps extends MarginSystemProps {
items: ({ label: string } & ComponentPropsWithoutRef<'a'>)[];
className?: string;
}

export const Breadcrumb: React.FC<BreadcrumbProps> = ({ items, ...props }) => (
Expand All @@ -17,7 +19,7 @@ export const Breadcrumb: React.FC<BreadcrumbProps> = ({ items, ...props }) => (
itemType="https://schema.org/BreadcrumbList"
gap="xxs-3"
fontWeight="semi-bold"
className="breadcrumb"
className={classNames('breadcrumb', props.className)}
>
{items.map(({ label, ...itemLink }, index) => (
<Fragment key={index}>
Expand Down
1 change: 1 addition & 0 deletions src/components/Organisms/Blocks/LastArticlesBlock/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './LastArticlesBlock';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './LastTutorialsBlock';
2 changes: 2 additions & 0 deletions src/components/Organisms/Blocks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './LastArticlesBlock';
export * from './LastTutorialsBlock';
1 change: 1 addition & 0 deletions src/components/Organisms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './PostCardList';
export * from './Autocomplete';
export * from './Header';
export * from './Footer';
export * from './Blocks';
15 changes: 7 additions & 8 deletions src/pages/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';

import type { HomeIntroBlockProps } from '@/components';
import { Box } from '@/components';
import { HomeIntroBlock } from '@/components';
import { NewsletterCard, type NewsletterCardProps } from '@/components/Molecules/Cards/NewsletterCard';
import type { LastArticlesBlockProps } from '@/components/Organisms/Blocks/LastArticlesBlock/LastArticlesBlock';
import { LastArticlesBlock } from '@/components/Organisms/Blocks/LastArticlesBlock/LastArticlesBlock';
import type { LastTutorialsBlockProps } from '@/components/Organisms/Blocks/LastTutorialsBlock/LastTutorialsBlock';
import { LastTutorialsBlock } from '@/components/Organisms/Blocks/LastTutorialsBlock/LastTutorialsBlock';
import type {
HomeIntroBlockProps,
LastArticlesBlockProps,
LastTutorialsBlockProps,
NewsletterCardProps,
} from '@/components';
import { Box, HomeIntroBlock, LastArticlesBlock, LastTutorialsBlock, NewsletterCard } from '@/components';

export type HomePageProps = {
homeIntroBlock: HomeIntroBlockProps;
Expand Down
87 changes: 87 additions & 0 deletions src/pages/PostPage/PostPage.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
@use 'sass:map';
@use '@/styles/abstracts' as *;

$heading-markup-config: map-get-strict($token-variables, 'typography', 'heading-markup');
$headings-by-compoent-variant-name: (
's': 'h5',
'm': 'h4',
'l': 'h3',
'xl': 'h2',
);

@mixin heading($config) {
$base-properties: ();

@if map.get($config, 'base') {
$base-properties: map.get($config, 'base');
}

@each $component-variant-name, $properties in $config {
@if $component-variant-name != 'base' {
#{map-get-strict($headings-by-compoent-variant-name, $component-variant-name)} {
@each $property-name, $property-value in map.merge($base-properties, $properties) {
#{$property-name}: #{$property-value};
}
}
}
}
}

.post-page {
--height-cover-post-page: 160px;

&__breadcrumb {
margin: #{map-get-strict($token-variables, 'spacing', 's')} 0;
padding: 0;
}

&__cover {
object-fit: cover;
width: 100%;
height: var(--height-cover-post-page);
border-radius: #{map-get-strict($token-variables, 'radius', 'xs')};

@include create-media-queries('md') {
--height-cover-post-page: 335px;
}
}

&__content {
@include heading($heading-markup-config);

p, ul, ol, blockquote {
margin: 0 0 #{map-get-strict($token-variables, 'spacing', 'xs')} 0;
}

blockquote {
padding: 0 var(--spacing-xxl);
font-family: Georgia, #{map-get-strict($token-variables, 'font-family', 'blockquote')};
font-size: #{map-get-strict($token-variables, 'typography', 'text', 'm', 'font-size')};
font-style: italic;
line-height: #{map-get-strict($token-variables, 'line-height', 'base')};

&::before, &::after {
content: "";
display: block;
height: 3rem;
line-height: 6rem;
font-size: 8rem;
font-weight: #{map-get-strict($token-variables, 'font-weight', 'medium')};
color: #{map-get-strict($token-variables, 'color', 'primary')};
}

&::before {
margin-left: calc(var(--spacing-xxl) * -1);
}

&::after {
margin-right: calc(var(--spacing-xxl) * -1);
transform: rotate(180deg);
}
}

figure {
text-align: center;
}
}
}
38 changes: 27 additions & 11 deletions src/pages/PostPage/PostPage.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
import React from 'react';

import { SummaryCard } from '@/components';
import { Box, Breadcrumb, type BreadcrumbProps, SummaryCard } from '@/components';
import { LayoutContentWithSidebar } from '@/templates/LayoutContentWithSidebar';
import type { ComponentPropsWithoutRef } from '@/types';

import './PostPage.scss';
import { PostPageContent } from './PostPageContent';

import type { PostPageContentProps } from './PostPageContent';

export interface PostPageProps extends PostPageContentProps {}
export interface PostPageProps extends PostPageContentProps {
breadcrumb: BreadcrumbProps;
cover: ComponentPropsWithoutRef<'img'>;
}

export const PostPage: React.FC<PostPageProps> = ({ variant = 'article', summary, children, ...postPageContent }) => (
<LayoutContentWithSidebar
content={
<PostPageContent variant={variant} summary={summary} {...postPageContent}>
{children}
</PostPageContent>
}
sidebar={<SummaryCard hiddenBelow="md" variant={variant === 'tutorial' ? 'secondary' : 'primary'} {...summary} />}
/>
export const PostPage: React.FC<PostPageProps> = ({
variant = 'article',
breadcrumb,
cover,
summary,
children,
...postPageContent
}) => (
<Box mx="auto" width="content-container" className="post-page">
<Breadcrumb {...breadcrumb} className="post-page__breadcrumb" />
<img className="post-page__cover" {...cover} alt={cover.alt} />
<LayoutContentWithSidebar
content={
<PostPageContent {...postPageContent} variant={variant} summary={summary}>
{children}
</PostPageContent>
}
sidebar={<SummaryCard hiddenBelow="md" variant={variant === 'tutorial' ? 'secondary' : 'primary'} {...summary} />}
/>
</Box>
);
81 changes: 0 additions & 81 deletions src/pages/PostPage/PostPageContent.scss

This file was deleted.

Loading

0 comments on commit dc8da68

Please sign in to comment.