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

refactor: ♻️ add page titles #27

Merged
merged 1 commit into from
Dec 3, 2020
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
2 changes: 1 addition & 1 deletion components/common/write-up.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class WriteUpComponent extends React.Component<Props, State> {
<>
<Row>
<Typography.Title level={2} className={classes.title}>
What is commit-composer?
What is Commit-composer?
</Typography.Title>
</Row>
<Row>
Expand Down
19 changes: 17 additions & 2 deletions layouts/main.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ const useStyles = (theme: CommitComposerTheme) =>

interface HookProps {
children: JSX.Element;
title?: string;
}

export const MainLayout: FunctionComponent<HookProps> = ({ children }) => {
export const MainLayout: FunctionComponent<HookProps> = ({ children, title }) => {
const theme = useTheme();
const classes = useStyles(theme)();
const siteName = 'Commit-composer';
const pageTitle = title ? `${siteName} - ${title}` : siteName;

return (
<>
Expand All @@ -47,13 +50,25 @@ export const MainLayout: FunctionComponent<HookProps> = ({ children }) => {
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<meta name="viewport" content="width=device-width,initial-scale=1" charSet="UTF-8" />
<title>{pageTitle}</title>
<meta property="og:site_name" content={siteName} />
<meta property="og:title" name="title" key="title" content={pageTitle} />
<meta
property="og:description"
name="description"
key="description"
content="A tool for composing conventional commit messages. Commit-composer aims to bridge the gap between your favorite Git GUI and beautifully structured commit messages for your repository."
/>
<meta
name="keywords"
content="commit-composer, conventional commits, commitlint, git, commitizen"></meta>
</Head>
<Layout className={classes.root}>
<Header className={classes.header}>
<Row justify="space-between">
<Col>
<Link href="/">
<h1 className={classes.titleContainer}>commit-composer.dev</h1>
<h1 className={classes.titleContainer}>Commit-composer.dev</h1>
</Link>
</Col>
<Col className={classes.buttonContainer}>
Expand Down
4 changes: 3 additions & 1 deletion pages/changelog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export interface State {
}

export class Changelog extends React.Component<Props, State> {
static getLayout = (page: JSX.Element): JSX.Element => <MainLayout>{page}</MainLayout>;
static getLayout = (page: JSX.Element): JSX.Element => (
<MainLayout title="Changelog">{page}</MainLayout>
);

constructor(props: Readonly<Props>) {
super(props);
Expand Down
4 changes: 3 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ type Props = WithStylesProps<typeof styles> & OwnProps & ReduxProps & DispatchPr
export interface State {}

export class Index extends React.Component<Props, State> {
static getLayout = (page: JSX.Element): JSX.Element => <MainLayout>{page}</MainLayout>;
static getLayout = (page: JSX.Element): JSX.Element => (
<MainLayout title="Conventional commit composer">{page}</MainLayout>
);

constructor(props: Readonly<Props>) {
super(props);
Expand Down