Skip to content

Commit

Permalink
Refactoring of code base #62: Remove react-helmet
Browse files Browse the repository at this point in the history
- replace with react-helmet async
- fixes untraceable console warnings
  • Loading branch information
bodobraegger committed Apr 10, 2023
1 parent e14b4c8 commit a086de1
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 54 deletions.
87 changes: 51 additions & 36 deletions package-lock.json

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

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"i18next-browser-languagedetector": "^7.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-helmet-async": "^1.3.0",
"react-i18next": "^12.1.4",
"react-markdown": "^8.0.5",
"react-quiz-component": "^0.5.1",
Expand All @@ -31,17 +31,17 @@
"web-vitals": "^3.1.1"
},
"devDependencies": {
"react-scripts": "^5.0.1",
"@craco/craco": "7.0.0",
"craco-less":"2.1.0-alpha.0",
"@types/react-helmet": "^6.1.6",
"@types/react-router-dom": "^5.3.3",
"@types/react-router-hash-link": "^2.4.5",
"@svgr/webpack": "^6.5.1",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@svgr/webpack": "^6.5.1",
"@types/react-helmet": "^6.1.6",
"@types/react-router-dom": "^5.3.3",
"@types/react-router-hash-link": "^2.4.5",
"craco-less": "2.1.0-alpha.0",
"react-scripts": "^5.0.1",
"serve": "^14.2.0"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Helmet } from 'react-helmet'
import { Helmet, HelmetProvider } from 'react-helmet-async'
import { withTranslation } from 'react-i18next'
import ReactMarkdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
Expand Down Expand Up @@ -43,7 +43,7 @@ function Section(props: Props) {


return <div className='content'>
<Helmet><title>{props.section['title']}</title></Helmet>
<HelmetProvider><title>{props.section['title']}</title></HelmetProvider>
<div className='content-main'>
<div id="section-title" className={classes}>
{props.section.icon && (<img className='icon' src={props.section.icon.url} alt="icon" />)}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/HomePage .tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import styled from '@emotion/styled'
import React from 'react'
import { Helmet } from 'react-helmet'
import { Helmet, HelmetProvider } from 'react-helmet-async'

import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
Expand All @@ -22,9 +22,9 @@ function HomePage(props: Props) {
const startPage = props.page

return <div className='content-main'>
<Helmet>
<HelmetProvider>
<title>{startPage.title}</title>
</Helmet>
</HelmetProvider>

<h1>{startPage.title}</h1>

Expand Down
6 changes: 3 additions & 3 deletions src/pages/ImpressumPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Helmet } from 'react-helmet'
import { Helmet, HelmetProvider } from 'react-helmet-async'
import { withTranslation } from 'react-i18next'
import i18n from '../i18n';
import client from '../client';
Expand All @@ -24,9 +24,9 @@ function ImpressumPage() {
if (!impressumPage) return null

return <div className='content-main'>
<Helmet>
<HelmetProvider>
<title>{impressumPage.title}</title>
</Helmet>
</HelmetProvider>
</div>
}
export default withTranslation()(ImpressumPage)
6 changes: 3 additions & 3 deletions src/pages/SearchPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Helmet } from 'react-helmet'
import { Helmet, HelmetProvider } from 'react-helmet-async'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
Expand All @@ -25,9 +25,9 @@ function SearchPage(props: Props) {
const lang = i18n.language

return <div className='content-main'>
<Helmet>
<HelmetProvider>
<title>{searchPage.title}</title>
</Helmet>
</HelmetProvider>

<div className='search'>
<h1><FontAwesomeIcon icon="search" /> {searchPage.title}</h1>
Expand Down

0 comments on commit a086de1

Please sign in to comment.