the browser-facing portion of osu!
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
2// See the LICENCE file in the repository root for full licence text.
3
4import NewsPostJson from 'interfaces/news-post-json';
5import { route } from 'laroute';
6import * as React from 'react';
7import { trans } from 'utils/lang';
8import HeaderV4 from './header-v4';
9
10interface Props {
11 post?: NewsPostJson;
12 section: string;
13 title: string;
14}
15
16export default function NewsHeader(props: Props) {
17 const links = [
18 {
19 active: props.section === 'index',
20 title: trans('news.index.title.info'),
21 url: route('news.index'),
22 },
23 ];
24
25 if (props.section === 'show' && props.post != null) {
26 links.push({
27 active: true,
28 title: props.post.title,
29 url: route('news.show', { news: props.post.slug }),
30 });
31 }
32
33 return (
34 <HeaderV4
35 links={links}
36 linksBreadcrumb
37 theme='news'
38 />
39 );
40}