Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新デザイン(2024年)のFooterComponentを作成 #345

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/app/_components/Footer.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Meta, StoryObj } from '@storybook/react';
import { Footer } from './Footer';

Check warning on line 2 in src/app/_components/Footer.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.stories.tsx#L2

Added line #L2 was not covered by tests

const meta = {
component: Footer,
} satisfies Meta<typeof Footer>;

Check warning on line 6 in src/app/_components/Footer.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.stories.tsx#L4-L6

Added lines #L4 - L6 were not covered by tests

export default meta;

Check warning on line 8 in src/app/_components/Footer.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.stories.tsx#L8

Added line #L8 was not covered by tests

type Story = StoryObj<typeof meta>;

export const ShowJapanese: Story = {
args: {
language: 'ja',
},
};

Check warning on line 16 in src/app/_components/Footer.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.stories.tsx#L12-L16

Added lines #L12 - L16 were not covered by tests

export const ShowEnglish: Story = {
args: {
language: 'en',
},
};

Check warning on line 22 in src/app/_components/Footer.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.stories.tsx#L18-L22

Added lines #L18 - L22 were not covered by tests
52 changes: 52 additions & 0 deletions src/app/_components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -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';

Check warning on line 5 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L3-L5

Added lines #L3 - L5 were not covered by tests
import type { JSX } from 'react';
import { Text } from 'react-aria-components';

Check warning on line 7 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L7

Added line #L7 was not covered by tests

export type Props = {
language: Language;
};

const linkStyle =
'text-[#43281E] font-inter text-sm font-normal leading-5 hover:underline';

Check warning on line 14 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L13-L14

Added lines #L13 - L14 were not covered by tests

export const Footer = ({ language }: Props): JSX.Element => {
const terms = createTermsOfUseLinksFromLanguages(language);

Check warning on line 17 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L16-L17

Added lines #L16 - L17 were not covered by tests

const privacy = createPrivacyPolicyLinksFromLanguages(language);

Check warning on line 19 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L19

Added line #L19 was not covered by tests

const externalTransmissionPolicy =
createExternalTransmissionPolicyLinksFromLanguages(language);

Check warning on line 22 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L21-L22

Added lines #L21 - L22 were not covered by tests

return (
<footer className="flex w-full flex-col">
<div className="mx-auto flex w-full max-w-[375px] items-center px-0 py-3 md:hidden">
<div className="flex flex-1 flex-col items-center justify-center gap-2">
<Link href={terms.link} prefetch={false} className={linkStyle}>
<Text data-gtm-click="footer-terms-link">{terms.text}</Text>

Check warning on line 29 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L24-L29

Added lines #L24 - L29 were not covered by tests
</Link>
<Link href={privacy.link} prefetch={false} className={linkStyle}>
<Text data-gtm-click="footer-privacy-link">{privacy.text}</Text>

Check warning on line 32 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L31-L32

Added lines #L31 - L32 were not covered by tests
</Link>
<Link
href={externalTransmissionPolicy.link}
prefetch={false}
className={linkStyle}

Check warning on line 37 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L34-L37

Added lines #L34 - L37 were not covered by tests
>
<Text data-gtm-click="footer-external-transmission-policy-link">
{externalTransmissionPolicy.text}

Check warning on line 40 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L39-L40

Added lines #L39 - L40 were not covered by tests
</Text>
</Link>
</div>
</div>
<div className="flex h-[60px] items-center justify-center self-stretch border-t border-orange-200 bg-orange-50">
<Text className="font-inter text-base font-medium text-orange-800">

Check warning on line 46 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L45-L46

Added lines #L45 - L46 were not covered by tests
Copyright (c) nekochans
</Text>
</div>
</footer>
);
};

Check warning on line 52 in src/app/_components/Footer.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/_components/Footer.tsx#L52

Added line #L52 was not covered by tests
29 changes: 29 additions & 0 deletions src/features/externalTransmissionPolicy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { type Language } from '@/features/language';
import { createIncludeLanguageAppPath } from '@/features/url';
import { assertNever } from '@/utils/assertNever';

Check warning on line 3 in src/features/externalTransmissionPolicy.ts

View check run for this annotation

Codecov / codecov/patch

src/features/externalTransmissionPolicy.ts#L2-L3

Added lines #L2 - L3 were not covered by tests
import type { LinkAttribute } from './linkAttribute';

export const createExternalTransmissionPolicyLinksFromLanguages = (
language: Language,

Check warning on line 7 in src/features/externalTransmissionPolicy.ts

View check run for this annotation

Codecov / codecov/patch

src/features/externalTransmissionPolicy.ts#L6-L7

Added lines #L6 - L7 were not covered by tests
): LinkAttribute => {
switch (language) {
case 'en':
return {
text: 'External Transmission Policy',
link: createIncludeLanguageAppPath(
'external-transmission-policy',
language,

Check warning on line 15 in src/features/externalTransmissionPolicy.ts

View check run for this annotation

Codecov / codecov/patch

src/features/externalTransmissionPolicy.ts#L9-L15

Added lines #L9 - L15 were not covered by tests
),
};
case 'ja':
return {
text: '外部送信ポリシー',
link: createIncludeLanguageAppPath(
'external-transmission-policy',
language,

Check warning on line 23 in src/features/externalTransmissionPolicy.ts

View check run for this annotation

Codecov / codecov/patch

src/features/externalTransmissionPolicy.ts#L17-L23

Added lines #L17 - L23 were not covered by tests
),
};
default:
return assertNever(language);
}
};

Check warning on line 29 in src/features/externalTransmissionPolicy.ts

View check run for this annotation

Codecov / codecov/patch

src/features/externalTransmissionPolicy.ts#L25-L29

Added lines #L25 - L29 were not covered by tests
6 changes: 6 additions & 0 deletions src/features/linkAttribute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { IncludeLanguageAppPath } from '@/features/url';

export type LinkAttribute = {
text: string;
link: IncludeLanguageAppPath;
};

Check warning on line 6 in src/features/linkAttribute.ts

View check run for this annotation

Codecov / codecov/patch

src/features/linkAttribute.ts#L6

Added line #L6 was not covered by tests
23 changes: 23 additions & 0 deletions src/features/privacyPolicy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { type Language } from '@/features/language';
import { createIncludeLanguageAppPath } from '@/features/url';
import { assertNever } from '@/utils/assertNever';

Check warning on line 3 in src/features/privacyPolicy.ts

View check run for this annotation

Codecov / codecov/patch

src/features/privacyPolicy.ts#L2-L3

Added lines #L2 - L3 were not covered by tests
import type { LinkAttribute } from './linkAttribute';

export const createPrivacyPolicyLinksFromLanguages = (
language: Language,

Check warning on line 7 in src/features/privacyPolicy.ts

View check run for this annotation

Codecov / codecov/patch

src/features/privacyPolicy.ts#L6-L7

Added lines #L6 - L7 were not covered by tests
): 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);
}
};

Check warning on line 23 in src/features/privacyPolicy.ts

View check run for this annotation

Codecov / codecov/patch

src/features/privacyPolicy.ts#L9-L23

Added lines #L9 - L23 were not covered by tests
23 changes: 23 additions & 0 deletions src/features/termsOfUse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { type Language } from '@/features/language';
import { createIncludeLanguageAppPath } from '@/features/url';
import { assertNever } from '@/utils/assertNever';

Check warning on line 3 in src/features/termsOfUse.ts

View check run for this annotation

Codecov / codecov/patch

src/features/termsOfUse.ts#L2-L3

Added lines #L2 - L3 were not covered by tests
import type { LinkAttribute } from './linkAttribute';

export const createTermsOfUseLinksFromLanguages = (
language: Language,

Check warning on line 7 in src/features/termsOfUse.ts

View check run for this annotation

Codecov / codecov/patch

src/features/termsOfUse.ts#L6-L7

Added lines #L6 - L7 were not covered by tests
): 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);
}
};

Check warning on line 23 in src/features/termsOfUse.ts

View check run for this annotation

Codecov / codecov/patch

src/features/termsOfUse.ts#L9-L23

Added lines #L9 - L23 were not covered by tests
Loading