diff --git a/src/app/_components/Footer.stories.tsx b/src/app/_components/Footer.stories.tsx new file mode 100644 index 0000000..2fbdb3a --- /dev/null +++ b/src/app/_components/Footer.stories.tsx @@ -0,0 +1,22 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { Footer } from './Footer'; + +const meta = { + component: Footer, +} satisfies Meta; + +export default meta; + +type Story = StoryObj; + +export const ShowJapanese: Story = { + args: { + language: 'ja', + }, +}; + +export const ShowEnglish: Story = { + args: { + language: 'en', + }, +}; diff --git a/src/app/_components/Footer.tsx b/src/app/_components/Footer.tsx new file mode 100644 index 0000000..266d676 --- /dev/null +++ b/src/app/_components/Footer.tsx @@ -0,0 +1,52 @@ +import { createExternalTransmissionPolicyLinksFromLanguages } from '@/features/externalTransmissionPolicy'; +import type { Language } from '@/features/language'; +import { createPrivacyPolicyLinksFromLanguages } from '@/features/privacyPolicy'; +import { createTermsOfUseLinksFromLanguages } from '@/features/termsOfUse'; +import Link from 'next/link'; +import type { JSX } from 'react'; +import { Text } from 'react-aria-components'; + +export type Props = { + language: Language; +}; + +const linkStyle = + 'text-[#43281E] font-inter text-sm font-normal leading-5 hover:underline'; + +export const Footer = ({ language }: Props): JSX.Element => { + const terms = createTermsOfUseLinksFromLanguages(language); + + const privacy = createPrivacyPolicyLinksFromLanguages(language); + + const externalTransmissionPolicy = + createExternalTransmissionPolicyLinksFromLanguages(language); + + return ( + + ); +}; diff --git a/src/features/externalTransmissionPolicy.ts b/src/features/externalTransmissionPolicy.ts new file mode 100644 index 0000000..f31b0de --- /dev/null +++ b/src/features/externalTransmissionPolicy.ts @@ -0,0 +1,29 @@ +import { type Language } from '@/features/language'; +import { createIncludeLanguageAppPath } from '@/features/url'; +import { assertNever } from '@/utils/assertNever'; +import type { LinkAttribute } from './linkAttribute'; + +export const createExternalTransmissionPolicyLinksFromLanguages = ( + language: Language, +): LinkAttribute => { + switch (language) { + case 'en': + return { + text: 'External Transmission Policy', + link: createIncludeLanguageAppPath( + 'external-transmission-policy', + language, + ), + }; + case 'ja': + return { + text: '外部送信ポリシー', + link: createIncludeLanguageAppPath( + 'external-transmission-policy', + language, + ), + }; + default: + return assertNever(language); + } +}; diff --git a/src/features/linkAttribute.ts b/src/features/linkAttribute.ts new file mode 100644 index 0000000..2b08bf0 --- /dev/null +++ b/src/features/linkAttribute.ts @@ -0,0 +1,6 @@ +import type { IncludeLanguageAppPath } from '@/features/url'; + +export type LinkAttribute = { + text: string; + link: IncludeLanguageAppPath; +}; diff --git a/src/features/privacyPolicy.ts b/src/features/privacyPolicy.ts new file mode 100644 index 0000000..3306349 --- /dev/null +++ b/src/features/privacyPolicy.ts @@ -0,0 +1,23 @@ +import { type Language } from '@/features/language'; +import { createIncludeLanguageAppPath } from '@/features/url'; +import { assertNever } from '@/utils/assertNever'; +import type { LinkAttribute } from './linkAttribute'; + +export const createPrivacyPolicyLinksFromLanguages = ( + language: Language, +): LinkAttribute => { + switch (language) { + case 'en': + return { + text: 'Privacy Policy', + link: createIncludeLanguageAppPath('privacy', language), + }; + case 'ja': + return { + text: 'プライバシーポリシー', + link: createIncludeLanguageAppPath('privacy', language), + }; + default: + return assertNever(language); + } +}; diff --git a/src/features/termsOfUse.ts b/src/features/termsOfUse.ts new file mode 100644 index 0000000..e239303 --- /dev/null +++ b/src/features/termsOfUse.ts @@ -0,0 +1,23 @@ +import { type Language } from '@/features/language'; +import { createIncludeLanguageAppPath } from '@/features/url'; +import { assertNever } from '@/utils/assertNever'; +import type { LinkAttribute } from './linkAttribute'; + +export const createTermsOfUseLinksFromLanguages = ( + language: Language, +): LinkAttribute => { + switch (language) { + case 'en': + return { + text: 'Terms of Use', + link: createIncludeLanguageAppPath('terms', language), + }; + case 'ja': + return { + text: '利用規約', + link: createIncludeLanguageAppPath('terms', language), + }; + default: + return assertNever(language); + } +};