Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/blocks/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const breadcrumbsGoals = prepareAnalyticsEvent({

export const Header = (props: HeaderProps) => {
const {theme, paddingTop, paddingBottom} = props;
const {post} = useContext(PostPageContext);
const {post, breadcrumbs: customBreadcrumbs = {}} = useContext(PostPageContext);
const {locale} = useContext(LocaleContext);
const {getBlogPath = getDefaultBlogPath} = useContext(SettingsContext);
const blogPath = getBlogPath(locale.pathPrefix || '');
Expand All @@ -55,7 +55,7 @@ export const Header = (props: HeaderProps) => {
{...props}
title={title}
description={description}
breadcrumbs={breadcrumbs}
breadcrumbs={{...breadcrumbs, ...customBreadcrumbs}}
>
<PostInfo
postId={id}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/containers/BlogPostPage/BlogPostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, {SyntheticEvent, useContext, useMemo} from 'react';
import {ShareOptions} from '@gravity-ui/components';
import {
CustomConfig,
HeaderBreadCrumbsProps,
NavigationData,
PageConstructor,
PageConstructorProvider,
Expand Down Expand Up @@ -39,6 +40,7 @@ export interface BlogPostPageProps {
isSignedInUser?: boolean;
// Required to enable Sign In on Post like
onClickSignIn?: React.EventHandler<SyntheticEvent>;
breadcrumbs?: HeaderBreadCrumbsProps;
}

export const BlogPostPage = ({
Expand All @@ -53,6 +55,7 @@ export const BlogPostPage = ({
shareOptions,
isSignedInUser = false,
onClickSignIn,
breadcrumbs,
}: BlogPostPageProps) => {
const {isAnimationEnabled} = useContext(SettingsContext);
const {hasUserLike, likesCount, handleLike} = useLikes({
Expand Down Expand Up @@ -90,6 +93,7 @@ export const BlogPostPage = ({
}
: undefined,
shareOptions,
breadcrumbs,
}}
>
<PageConstructorProvider
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {Default, WithNavigation} from './helpers';
const BLOG_POST_PAGE_DALAY = 10 * 1000;

test.describe('BlogPostPage', () => {
test('render stories <Default>', async ({mount, expectScreenshot, delay}) => {
test('render stories <Default>', async ({mount, expectScreenshot, delay, page}) => {
await mount(<Default />);
await delay(BLOG_POST_PAGE_DALAY);
await expectScreenshot({skipTheme: 'dark'});
await expectScreenshot({skipTheme: 'dark', mask: [page.locator('.pc-Media__youtube')]});
});

test('render stories <WithNavigation>', async ({mount, expectScreenshot, delay}) => {
test('render stories <WithNavigation>', async ({mount, expectScreenshot, delay, page}) => {
await mount(<WithNavigation />);
await delay(BLOG_POST_PAGE_DALAY);
await expectScreenshot({skipTheme: 'dark'});
await expectScreenshot({skipTheme: 'dark', mask: [page.locator('.pc-Media__youtube')]});
});
});
2 changes: 2 additions & 0 deletions src/contexts/PostPageContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import {ShareOptions} from '@gravity-ui/components';

import {PostData} from '../models/common';
import {HeaderBreadCrumbsProps} from '@gravity-ui/page-constructor';

export type LikesRoutineType = {
handleUserLike: () => void;
Expand All @@ -15,6 +16,7 @@ export interface PostPageContextProps {
suggestedPosts: PostData[];
likes?: LikesRoutineType;
shareOptions?: ShareOptions[];
breadcrumbs?: HeaderBreadCrumbsProps;
}

export const PostPageContext = React.createContext<PostPageContextProps>(
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export * from './models/locale';
export * from './schema';

export {BREAKPOINTS} from './constants';

export * from './utils';
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {getBreadcrumbs} from './common';