Skip to content

Commit

Permalink
feat: add feedback button
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxSchaefer committed Aug 14, 2023
1 parent f2f2cc9 commit 14e26a5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
28 changes: 28 additions & 0 deletions tasks/components/FeedbackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Button } from '@helpwave/common/components/Button'
import { PropsWithLanguage, useTranslation } from '@helpwave/common/hooks/useTranslation';
import { Languages } from '@helpwave/common/hooks/useLanguage';

type FeedbackButtonTranslation = {
text: string
}

const defaultFeedbackButtonTranslation: Record<Languages, FeedbackButtonTranslation> = {
en: {
text: 'Issue or Feedback?'
},
de: {
text: 'Fehler oder Feedback?'
}
}

export const FeedbackButton = ({ language }: PropsWithLanguage<FeedbackButtonTranslation>) => {
const translation = useTranslation(language, defaultFeedbackButtonTranslation)

const onClick = () => window.open('https://share-eu1.hsforms.com/1Libxb_ANSm-CpMCQ37Ti6Qfsrtd', '_blank')

return (
<Button variant="tertiary" color="neutral" onClick={onClick}>
{translation.text}
</Button>
)
}
4 changes: 3 additions & 1 deletion tasks/components/layout/PageWithHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { UserMenu } from '../UserMenu'
import type { Crumb } from '../BreadCrumb'
import { BreadCrumb } from '../BreadCrumb'
import { useAuth } from '../../hooks/useAuth'
import { FeedbackButton } from '../FeedbackButton';

type PageWithHeaderProps = Partial<HeaderProps> & {
crumbs?: Crumb[]
Expand All @@ -28,6 +29,7 @@ export const PageWithHeader = ({

if (!user) return null

const feedbackButton = <FeedbackButton/>
const userMenu = <UserMenu />

return (
Expand All @@ -36,7 +38,7 @@ export const PageWithHeader = ({
title={title}
withIcon={withIcon}
leftSide={[(crumbs ? <BreadCrumb crumbs={crumbs}/> : undefined), ...(leftSide ?? [])]}
rightSide={[...(rightSide ?? []), userMenu]}
rightSide={[...(rightSide ?? []), feedbackButton, userMenu]}
/>
{children}
</div>
Expand Down

0 comments on commit 14e26a5

Please sign in to comment.