Skip to content

Commit

Permalink
feat: use @helpwave/common in landing-page/
Browse files Browse the repository at this point in the history
  • Loading branch information
JaninaWibker committed Feb 4, 2023
1 parent 5b4f6d8 commit 8fd60ec
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dependencies
/node_modules
/.pnp
node_modules
.pnp
.pnp.js

# debug
Expand Down
34 changes: 34 additions & 0 deletions landing-page/components/LanguageSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { tw } from '@twind/core'
import { useTranslation } from '@helpwave/common/hooks/useTranslation'
import { useLanguage } from '@helpwave/common/hooks/useLanguage'
import type { Languages } from '@helpwave/common/hooks/useLanguage'

type LanguageSwitcherTranslation = {
toggleLanguage: string
}

const defaultLanguageSwitcherTranslations: Record<Languages, LanguageSwitcherTranslation> = {
en: {
toggleLanguage: 'Toggle language',
},
de: {
toggleLanguage: 'Sprache wechseln',
}
}

// TODO: Basic and naive implementation of a LanguageSwitcher
const LanguageSwitcher = () => {
const { language, setLanguage } = useLanguage()
const translation = useTranslation(language, defaultLanguageSwitcherTranslations)

const onClick = () => {
if (language === 'de') setLanguage('en')
if (language === 'en') setLanguage('de')
}

return (
<button className={tw('border-2 m-2 p-1 border-gray-800 text-white w-44')} onClick={onClick}>{translation.toggleLanguage}</button>
)
}

export default LanguageSwitcher
6 changes: 3 additions & 3 deletions landing-page/components/sections/ContactSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { Toast } from '../Toast'
import Send from '../../icons/Send'
import AlertCircle from '../../icons/AlertCircle'
import { hubspotSubmitForm } from '../../utils/hubspot'
import { useTranslation } from '../../hooks/useTranslation'
import type { PropsWithLanguage } from '../../hooks/useTranslation'
import type { Languages } from '../../hooks/useLanguage'
import { useTranslation } from '@helpwave/common/hooks/useTranslation'
import type { PropsWithLanguage } from '@helpwave/common/hooks/useTranslation'
import type { Languages } from '@helpwave/common/hooks/useLanguage'

type ContactSectionLanguage = {
heading: string,
Expand Down
6 changes: 3 additions & 3 deletions landing-page/components/sections/FeaturesSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { forwardRef } from 'react'
import { Section } from '../Section'
import { tw, tx } from '@twind/core'
import { Checkbox } from '../Checkbox'
import { useTranslation } from '../../hooks/useTranslation'
import type { PropsWithLanguage } from '../../hooks/useTranslation'
import type { Languages } from '../../hooks/useLanguage'
import { useTranslation } from '@helpwave/common/hooks/useTranslation'
import type { PropsWithLanguage } from '@helpwave/common/hooks/useTranslation'
import type { Languages } from '@helpwave/common/hooks/useLanguage'

export type FeaturesSectionLanguage = {
heading: string,
Expand Down
6 changes: 3 additions & 3 deletions landing-page/components/sections/PartnerSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { TitleSection } from '../Section'
import StadtWarendorf from '../../icons/partners/StadtWarendorf'
import Ukm from '../../icons/partners/ukm'
import MSHack from '../../icons/partners/MSHack'
import { useTranslation } from '../../hooks/useTranslation'
import type { PropsWithLanguage } from '../../hooks/useTranslation'
import type { Languages } from '../../hooks/useLanguage'
import { useTranslation } from '@helpwave/common/hooks/useTranslation'
import type { PropsWithLanguage } from '@helpwave/common/hooks/useTranslation'
import type { Languages } from '@helpwave/common/hooks/useLanguage'

const partners = [
{ name: 'Muensterhack', Icon: MSHack, url: 'https://www.muensterhack.de/' },
Expand Down
6 changes: 3 additions & 3 deletions landing-page/components/sections/RoadmapSection.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { forwardRef } from 'react'
import { tw } from '@twind/core'
import { TitleSection } from '../Section'
import { useTranslation } from '../../hooks/useTranslation'
import type { PropsWithLanguage } from '../../hooks/useTranslation'
import type { Languages } from '../../hooks/useLanguage'
import { useTranslation } from '@helpwave/common/hooks/useTranslation'
import type { PropsWithLanguage } from '@helpwave/common/hooks/useTranslation'
import type { Languages } from '@helpwave/common/hooks/useLanguage'

export type RoadmapSectionLanguage = {
heading: string
Expand Down
6 changes: 3 additions & 3 deletions landing-page/components/sections/StartSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { tw } from '@twind/core'
import Header from '../Header'
import Helpwave from '../../icons/HelpwaveRect'
import { Checkbox } from '../Checkbox'
import type { Languages } from '../../hooks/useLanguage'
import { useTranslation } from '../../hooks/useTranslation'
import type { PropsWithLanguage } from '../../hooks/useTranslation'
import { useTranslation } from '@helpwave/common/hooks/useTranslation'
import type { PropsWithLanguage } from '@helpwave/common/hooks/useTranslation'
import type { Languages } from '@helpwave/common/hooks/useLanguage'

export type StartSectionLanguage = {
HeroMessageComponent: ReactFC,
Expand Down
6 changes: 3 additions & 3 deletions landing-page/components/sections/TeamSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { forwardRef } from 'react'
import { tw } from '@twind/core'
import GridBox from '../GridBox'
import { Section } from '../Section'
import { useTranslation } from '../../hooks/useTranslation'
import type { PropsWithLanguage } from '../../hooks/useTranslation'
import type { Languages } from '../../hooks/useLanguage'
import { useTranslation } from '@helpwave/common/hooks/useTranslation'
import type { PropsWithLanguage } from '@helpwave/common/hooks/useTranslation'
import type { Languages } from '@helpwave/common/hooks/useLanguage'

const roles = { /* eslint-disable key-spacing, no-multi-spaces */
FRONTEND_DEVELOPER: { id: 'FRONTEND_DEVELOPER', name: 'Frontend Developer', color: 'hw-primary-300' },
Expand Down
1 change: 1 addition & 0 deletions landing-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@helpwave/common": "workspace:*",
"@next/font": "^13.0.6",
"@radix-ui/react-checkbox": "^1.0.1",
"@twind/core": "^1.1.2",
Expand Down
2 changes: 1 addition & 1 deletion landing-page/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Inter, Space_Grotesk as SpaceGrotesk } from '@next/font/google'
import { tw } from '@twind/core'
import withNextApp from '../twind/next/app'
import { config } from '../twind.config'
import { ProvideLanguage } from '../hooks/useLanguage'
import { ProvideLanguage } from '@helpwave/common/hooks/useLanguage'

const inter = Inter({
subsets: ['latin'],
Expand Down
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 8fd60ec

Please sign in to comment.