Skip to content

Commit

Permalink
Merge pull request #49 from ReoHakase/48/refactor-dir-structure
Browse files Browse the repository at this point in the history
refactor: ♻️ (web) コンポーネントのディレクトリ構造を修正した。  (#48)
  • Loading branch information
ReoHakase authored May 28, 2024
2 parents f89fd70 + 3994abe commit f835ac2
Show file tree
Hide file tree
Showing 30 changed files with 68 additions and 26 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/app/[statLabel]/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement } from 'react';
import { Skeleton } from '@/features/navigation/components/Skeleton/Skeleton';
import { Skeleton } from '@/components/Skeleton';
import { PopulationChartSkeleton } from '@/features/population/components/PopulationChart/PopulationChart.skeleton';
import { css } from 'styled-system/css';

Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/app/[statLabel]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import type { Metadata } from 'next';
import type { ReactElement } from 'react';
import { Suspense } from 'react';
import { metadata as layoutMetadata, defaultTitle } from '../layout';
import { PopulationChart } from '@/features/population/components/PopulationChart/PopulationChart';
import { PopulationChartSkeleton } from '@/features/population/components/PopulationChart/PopulationChart.skeleton';
import { PopulationChart, PopulationChartSkeleton } from '@/features/population/components/PopulationChart';
import { fetchPrefectures } from '@/infra/resas/fetchPrefectures';
import { getGraphPageTitleLocaleJa } from '@/libs/getGraphPageTitleLocale';
import type { PrefCode } from '@/models/prefCode';
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Analytics } from '@vercel/analytics/react';
import type { Metadata, Viewport } from 'next';
import type { FC, ReactNode } from 'react';
import { Aurora } from '@/features/landingPage/components/Aurora/Aurora';
import { Header } from '@/features/navigation/components/Header/Header';
import { Aurora } from '@/features/decoration/components/Aurora';
import { Header } from '@/features/navigation/components/Header';
import { PrefectureForm } from '@/features/navigation/components/PrefectureForm/PrefectureForm';
import { AppProvider } from '@/providers';
import { fontVariables } from '@/styles/fonts';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Building2, ArrowRight, HomeIcon, MapPin } from 'lucide-react';
import type { ReactNode } from 'react';
import { Link } from '@/components/Link/Link';
import { Link } from '@/components/Link';
import { css } from 'styled-system/css';

const Home = (): ReactNode => {
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/components/Chart/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { Chart } from './Chart';
export type { ChartProps } from './Chart';
export { getUniqueLineColor } from './lineColors';
export type { LineColor } from './lineColors';
2 changes: 2 additions & 0 deletions apps/web/src/components/Checkbox/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Checkbox } from './Checkbox';
export type { CheckboxProps } from './Checkbox';
2 changes: 2 additions & 0 deletions apps/web/src/components/Image/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Image } from './Image';
export type { ImageProps, ImageSizeDimension } from './Image';
2 changes: 2 additions & 0 deletions apps/web/src/components/Link/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Link } from './Link';
export type { LinkProps } from './Link';
16 changes: 16 additions & 0 deletions apps/web/src/components/Select/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export {
Select,
SelectGroup,
SelectValue,
SelectTrigger,
SelectIcon,
SelectViewport,
SelectPortal,
SelectContent,
SelectItemIndicator,
SelectItem,
SelectItemText,
SelectItemDescription,
SelectLabel,
SelectSeparator,
} from './Select';
2 changes: 2 additions & 0 deletions apps/web/src/components/Skeleton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Skeleton } from './Skeleton';
export type { SkeletonProps } from './Skeleton';
2 changes: 2 additions & 0 deletions apps/web/src/features/decoration/components/Aurora/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Aurora } from './Aurora';
export type { AuroraProps } from './Aurora';
8 changes: 4 additions & 4 deletions apps/web/src/features/navigation/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { GithubIcon, Sigma, Baby, PersonStanding, Accessibility } from 'lucide-react';
import type { ReactNode, ComponentPropsWithoutRef } from 'react';
import { Suspense } from 'react';
import { ThemeSelect } from '../ThemeSelect/ThemeSelect';
import { TopNavigationLink, TopNavigationLinkFallback } from '../TopNavigation/TopNavigationLink';
import { Image } from '@/components/Image/Image';
import { Link } from '@/components/Link/Link';
import { ThemeSelect } from '../ThemeSelect';
import { TopNavigationLink, TopNavigationLinkFallback } from '../TopNavigation';
import { Image } from '@/components/Image';
import { Link } from '@/components/Link';
import HeaderIconImage from '@public/icon.webp';
import { css } from 'styled-system/css';
import { flex } from 'styled-system/patterns';
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/features/navigation/components/Header/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Header } from './Header';
export type { HeaderProps } from './Header';
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { usePathname, useSearchParams, useRouter } from 'next/navigation';
import { useCallback, useMemo } from 'react';
import type { ReactNode, ChangeEvent } from 'react';
import { Checkbox } from '@/components/Checkbox/Checkbox';
import type { CheckboxProps } from '@/components/Checkbox/Checkbox';
import { Checkbox } from '@/components/Checkbox';
import type { CheckboxProps } from '@/components/Checkbox';
import { prefCodesSchema } from '@/models/prefCode';
import type { PrefCode } from '@/models/prefCode';
import { cx } from 'styled-system/css';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { PrefectureCheckbox } from './PrefectureCheckbox';
export type { PrefectureCheckboxProps } from './PrefectureCheckbox';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement, ComponentPropsWithoutRef } from 'react';
import { PrefectureCheckbox } from '../PrefectureCheckbox/PrefectureCheckbox';
import { PrefectureCheckbox } from '../PrefectureCheckbox';
import { fetchPrefectures } from '@/infra/resas/fetchPrefectures';
import { cx, css } from 'styled-system/css';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { PrefectureCheckboxFieldset } from './PrefectureCheckboxFieldset';
export type { PrefectureCheckboxFieldsetProps } from './PrefectureCheckboxFieldset';
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { ReactElement, ComponentPropsWithoutRef } from 'react';
import { Suspense } from 'react';
import { PrefectureCheckboxFieldset } from '../PrefectureCheckboxFieldset/PrefectureCheckboxFieldset';
import { PrefectureStateBar } from '@/features/navigation/components/PrefectureStateBar/PrefectureStateBar';
import { SELECTION_STATE_LABEL_ID } from '@/features/navigation/components/PrefectureStateBar/PrefectureStateBar';
import { Skeleton } from '@/features/navigation/components/Skeleton/Skeleton';
import { PrefectureCheckboxFieldset } from '../PrefectureCheckboxFieldset';
import { PrefectureStateBar, SELECTION_STATE_LABEL_ID } from '../PrefectureStateBar';
import { Skeleton } from '@/components/Skeleton';
import { cx, css } from 'styled-system/css';

export type PrefectureFormProps = ComponentPropsWithoutRef<'form'>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { X } from 'lucide-react';
import { usePathname } from 'next/navigation';
import { ReactNode } from 'react';
import { Link } from '@/components/Link/Link';
import type { LinkProps } from '@/components/Link/Link';
import { Link } from '@/components/Link';
import type { LinkProps } from '@/components/Link';
import { css, cx } from 'styled-system/css';

export type PrefectureClearButtonProps<T> = Omit<LinkProps<T>, 'href' | 'children'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ArrowDown } from 'lucide-react';
import { ReactNode, ComponentPropsWithoutRef } from 'react';
import { Suspense } from 'react';
import { Skeleton } from '../Skeleton/Skeleton';
import { PrefectureClearButton } from './PrefectureClearButton';
import { PrefectureCount } from './PrefectureCount';
import { Skeleton } from '@/components/Skeleton';
import { css, cx } from 'styled-system/css';

export const SELECTION_STATE_LABEL_ID = 'selection-state-label' as const;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { PrefectureStateBar, SELECTION_STATE_LABEL_ID } from './PrefectureStateBar';
export type { PrefectureStateBarProps } from './PrefectureStateBar';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Check, Sun, Moon, SwatchBook } from 'lucide-react';
import { useTheme } from 'next-themes';
import { forwardRef, useCallback, useEffect, useState } from 'react';
import type { ElementRef, ComponentPropsWithoutRef } from 'react';
import { Skeleton } from '../Skeleton/Skeleton';
import {
Select,
SelectGroup,
Expand All @@ -17,12 +16,13 @@ import {
SelectItemText,
SelectItem,
SelectLabel,
} from '@/components/Select/Select';
} from '@/components/Select';
import { Skeleton } from '@/components/Skeleton';
import { css, cx } from 'styled-system/css';

type ThemeValue = 'system' | 'light' | 'dark';

type ThemeSelectProps = ComponentPropsWithoutRef<typeof Select> &
export type ThemeSelectProps = ComponentPropsWithoutRef<typeof Select> &
Pick<ComponentPropsWithoutRef<typeof SelectTrigger>, 'className'> &
Pick<ComponentPropsWithoutRef<typeof SelectPortal>, 'container'>;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { ThemeSelect } from './ThemeSelect';
export type { ThemeSelectProps } from './ThemeSelect';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { TopNavigationLink, TopNavigationLinkFallback } from './TopNavigationLink';
export type { TopNavigationLinkProps } from './TopNavigationLink';
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { ReactElement } from 'react';
import type { ComponentPropsWithoutRef } from 'react';
import { Chart } from '@/components/Chart/Chart';
import type { ChartProps } from '@/components/Chart/Chart';
import { getUniqueLineColor } from '@/components/Chart/lineColors';
import type { ChartProps } from '@/components/Chart';
import { Chart, getUniqueLineColor } from '@/components/Chart';
import { fetchPrefectures } from '@/infra/resas/fetchPrefectures';
import { extractDataPointsByStatLabel } from '@/libs/extractDataPointsByStatLabel';
import { getPopulationCompositionAll } from '@/libs/getPopulationCompositionAll';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { PopulationChart } from './PopulationChart';
export type { PopulationChartProps } from './PopulationChart';
export { PopulationChartSkeleton } from './PopulationChart.skeleton';

0 comments on commit f835ac2

Please sign in to comment.