Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added description field to companies block #692

Merged
merged 7 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/blocks/Companies/Companies.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ $block: '.#{$ns}companies-block';
@include heading2();
}

&__description {
margin-top: $indentXXS;
}

&__images {
margin-top: $indentM;
}
Expand Down
9 changes: 7 additions & 2 deletions src/blocks/Companies/Companies.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import {Image} from '../../components';
import {Image, YFMWrapper} from '../../components';
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
import {useTheme} from '../../context/theme';
import {CompaniesBlockProps} from '../../models';
Expand All @@ -10,14 +10,19 @@ import './Companies.scss';

const b = block('companies-block');

export const CompaniesBlock = ({title, images, animated}: CompaniesBlockProps) => {
export const CompaniesBlock = ({title, description, images, animated}: CompaniesBlockProps) => {
const theme = useTheme();
const themedImages = getThemedValue(images, theme) || {};

return (
<AnimateBlock className={b()} offset={150} animate={animated}>
<div className={b('content')}>
<h2 className={b('title')}>{title}</h2>
{description && (
<div className={b('description')}>
<YFMWrapper content={description} modifiers={{constructor: true}} />
</div>
)}
yuberdysheva marked this conversation as resolved.
Show resolved Hide resolved
<div className={b('images')}>
<Image {...themedImages} className={b('image')} />
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/Companies/__stories__/Companies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import * as CompaniesStories from './Companies.stories.tsx';

`title: string` — Title

`description?: string` — Description
VitaliiDC8 marked this conversation as resolved.
Show resolved Hide resolved

`images: ImageDeviceProps` — Images for different screen sizes (see in common types)
</StoryTemplate>

1 change: 1 addition & 0 deletions src/models/constructor-items/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export interface BannerBlockProps extends BannerCardProps, Animatable {}

export interface CompaniesBlockProps extends Animatable {
title: string;
description?: string;
images: ThemeSupporting<ImageDeviceProps>;
}

Expand Down
Loading