Skip to content

Commit

Permalink
Merge pull request #578 from Studio-Yandex-Practicum/bugfix-project-d…
Browse files Browse the repository at this point in the history
…escription

Bugfix project description
  • Loading branch information
AntonZelinsky authored Sep 8, 2024
2 parents 65ea086 + d761557 commit 1a21723
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/__generated__/api-typings/models/Project.ts

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

Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ import { ProjectLayoutStorey } from '../storey';
import styles from './project-layout-description.module.css';

interface IProjectLayoutDescriptionProps {
children: string
descriptionCaption: string
description: string
}

const cx = classNames.bind(styles);

export const ProjectLayoutDescription = ({ children }: IProjectLayoutDescriptionProps): JSX.Element => {
export const ProjectLayoutDescription = ({ descriptionCaption, description }: IProjectLayoutDescriptionProps): JSX.Element => {

return (
<ProjectLayoutStorey type="description">
<section>
<h2 className={cx('title')}>
О проекте
{descriptionCaption}
</h2>
<p className={cx('text')}>
{children}
{description}
</p>
</section>
</ProjectLayoutStorey>
Expand Down
1 change: 1 addition & 0 deletions src/core/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type Project = {
export type ProjectDetailed = {
title: string
intro: string
descriptionCaption: string
description: string
image: string
contents: BaseContent[]
Expand Down
5 changes: 2 additions & 3 deletions src/pages/projects/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Project = (props: InferGetServerSidePropsType<typeof getServerSideProps>)
const {
title,
intro,
descriptionCaption,
description,
image,
contents,
Expand All @@ -39,9 +40,7 @@ const Project = (props: InferGetServerSidePropsType<typeof getServerSideProps>)
intro={intro}
image={image}
/>
<ProjectLayout.Description>
{description}
</ProjectLayout.Description>
<ProjectLayout.Description {...{ descriptionCaption, description }}/>
<ConstructorContent
variant="project"
// @ts-expect-error: TODO: В документации API нет описания ответов с блоками конструктора
Expand Down
1 change: 1 addition & 0 deletions src/services/api/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function mapDTOtoProjectDetailed(dto: ProjectDTO): ProjectDetailed {
title: dto.title,
intro: dto.intro,
description: dto.description,
descriptionCaption: dto.description_caption,
image: dto.image,
contents: dto.contents,
};
Expand Down

0 comments on commit 1a21723

Please sign in to comment.