Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
refactor(pagetitle): migrate pagetitle to typescript
Browse files Browse the repository at this point in the history
- migrate to typescript
- add description field to page title
- add package installation for @types/react-helmet
  • Loading branch information
LinHuiqing committed Sep 30, 2021
1 parent e065c37 commit 41c0f9c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
9 changes: 9 additions & 0 deletions client/package-lock.json

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

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@types/html-to-draftjs": "^1.4.0",
"@types/react-draft-wysiwyg": "^1.13.2",
"@types/react-google-recaptcha": "^2.1.2",
"@types/react-helmet": "^6.1.2",
"@types/react-router-dom": "^5.3.0",
"@types/styled-components": "^5.1.14",
"@typescript-eslint/eslint-plugin": "^4.32.0",
Expand Down
14 changes: 0 additions & 14 deletions client/src/components/PageTitle/PageTitle.component.jsx

This file was deleted.

24 changes: 24 additions & 0 deletions client/src/components/PageTitle/PageTitle.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Helmet from 'react-helmet'

const PageTitle = ({
title,
description,
}: {
title: string | undefined
description: string | undefined
}) => {
const defaultTitle = 'AskGov'
const defaultDescription = 'Answers from the Singapore Government'

return (
<Helmet>
<title>{title ? title : defaultTitle}</title>
<meta
name="description"
content={description ? description : defaultDescription}
/>
</Helmet>
)
}

export default PageTitle

0 comments on commit 41c0f9c

Please sign in to comment.