Skip to content

Commit

Permalink
テキスト系をバンドルから消してlazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-20 committed Mar 23, 2024
1 parent 531dcbe commit a556492
Show file tree
Hide file tree
Showing 7 changed files with 17,748 additions and 10 deletions.
22 changes: 12 additions & 10 deletions workspaces/app/src/foundation/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import React, { useId } from 'react';
import styled from 'styled-components';

import { DialogContentAtom } from '../atoms/DialogContentAtom';
import { COMPANY } from '../constants/Company';
import { CONTACT } from '../constants/Contact';
import { OVERVIEW } from '../constants/Overview';
import { QUESTION } from '../constants/Question';
import { TERM } from '../constants/Term';
import { useResource } from '../hooks/useResource';
import { Color, Space, Typography } from '../styles/variables';

import { Box } from './Box';
Expand All @@ -25,6 +21,12 @@ const _Content = styled.section`
`;

export const Footer: React.FC = () => {
const term = useResource('/assets/texts/term.txt');
const contact = useResource('/assets/texts/contact.txt');
const question = useResource('/assets/texts/question.txt');
const company = useResource('/assets/texts/company.txt');
const overview = useResource('/assets/texts/overview.txt');

const [isClient, setIsClient] = React.useState(false);

React.useEffect(() => {
Expand All @@ -47,7 +49,7 @@ export const Footer: React.FC = () => {
</Text>
<Spacer height={Space * 1} />
<Text as="p" color={Color.MONO_100} typography={Typography.NORMAL12}>
{TERM}
{term}
</Text>
</_Content>,
);
Expand All @@ -61,7 +63,7 @@ export const Footer: React.FC = () => {
</Text>
<Spacer height={Space * 1} />
<Text as="p" color={Color.MONO_100} typography={Typography.NORMAL12}>
{CONTACT}
{contact}
</Text>
</_Content>,
);
Expand All @@ -75,7 +77,7 @@ export const Footer: React.FC = () => {
</Text>
<Spacer height={Space * 1} />
<Text as="p" color={Color.MONO_100} typography={Typography.NORMAL12}>
{QUESTION}
{question}
</Text>
</_Content>,
);
Expand All @@ -89,7 +91,7 @@ export const Footer: React.FC = () => {
</Text>
<Spacer height={Space * 1} />
<Text as="p" color={Color.MONO_100} typography={Typography.NORMAL12}>
{COMPANY}
{company}
</Text>
</_Content>,
);
Expand All @@ -103,7 +105,7 @@ export const Footer: React.FC = () => {
</Text>
<Spacer height={Space * 1} />
<Text as="p" color={Color.MONO_100} typography={Typography.NORMAL12}>
{OVERVIEW}
{overview}
</Text>
</_Content>,
);
Expand Down
8 changes: 8 additions & 0 deletions workspaces/app/src/foundation/hooks/useResource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import useImmutableSWR from 'swr/immutable';

const fetcher = (url: string) => fetch(url).then((res) => res.text());

export const useResource = (path: string) => {
const { data } = useImmutableSWR(path, fetcher);
return data;
};
2,377 changes: 2,377 additions & 0 deletions workspaces/client/assets/texts/company.txt

Large diffs are not rendered by default.

6,142 changes: 6,142 additions & 0 deletions workspaces/client/assets/texts/contact.txt

Large diffs are not rendered by default.

1,597 changes: 1,597 additions & 0 deletions workspaces/client/assets/texts/overview.txt

Large diffs are not rendered by default.

3,417 changes: 3,417 additions & 0 deletions workspaces/client/assets/texts/question.txt

Large diffs are not rendered by default.

4,195 changes: 4,195 additions & 0 deletions workspaces/client/assets/texts/term.txt

Large diffs are not rendered by default.

0 comments on commit a556492

Please sign in to comment.