Skip to content

Commit

Permalink
refactor: layout folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jaslioin committed Feb 17, 2022
1 parent b69adbd commit f568e4e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
10 changes: 3 additions & 7 deletions src/containers/CatExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import { useSetState } from "react-use";
import styled from "styled-components";
import { useMemo, useRef, useState } from "react";
import { catApi } from "@/services/catApi";
import { FlexSection } from "@/components/FlexSection";
import { FlexSection } from "@/layouts/FlexSection";
import Card from "@/components/Card";
import notFound from "@/assets/cat-not-found.jpg";
import { FixedDiv } from "@/components/FixedDiv";
import { FixedDiv } from "@/layouts/FixedDiv";
import { Modal, ModalRefObject } from "@/components/Modal";
import { CatDetail } from "@/pages/CatDetail";
import { Breed } from "@/types/cat";
import LoadingPage from "@/pages/LoadingPage";
import { Button } from "@/components/Button";
import { Container } from "@/layouts/Container";

export default function CatExplorer() {
const modalRef = useRef<ModalRefObject>();
Expand Down Expand Up @@ -126,11 +127,6 @@ export default function CatExplorer() {
</Container>
);
}
const Container = styled.div`
height: 100vh;
display: flex;
align-items: center;
`;

const StyledFlexSection = styled(FlexSection)`
width: 100vw;
Expand Down
22 changes: 10 additions & 12 deletions src/containers/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import styled from "styled-components";
import { Link } from "react-router-dom";
import { Path } from "@/constants/paths";
import { FlexSection } from "@/components/FlexSection";
import { Container } from "@/layouts/Container";

export default function Home() {
return (
<div>
<Container justify="center" align="center" direction="column">
<CatLogo>🐱</CatLogo>
<Title>Cat Explorer</Title>
<StyledSection justify="center" align="center">
<StyledLink to={Path.CAT_EXPLORER}>
<StyledButton type="button">Start!</StyledButton>
</StyledLink>
</StyledSection>
</div>
<StyledLink to={Path.CAT_EXPLORER}>
<StyledButton type="button">Start!</StyledButton>
</StyledLink>
</Container>
);
}

const CatLogo = styled.div`
font-size: 7rem;
`;
const Title = styled.h1`
text-align: center;
`;
Expand All @@ -29,6 +30,3 @@ const StyledButton = styled.button`
width: 6rem;
height: 4rem;
`;
const StyledSection = styled(FlexSection)`
height: 100%;
`;
8 changes: 8 additions & 0 deletions src/layouts/Container.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from "styled-components";
import { FlexSection } from "./FlexSection";

export const Container = styled(FlexSection).attrs((p) => ({
...p,
}))`
height: 100vh;
`;
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/CatDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable camelcase */
import styled from "styled-components";
import { FlexSection } from "@/components/FlexSection";
import { FlexSection } from "@/layouts/FlexSection";
import { Breed } from "@/types/cat";

type Props = Partial<Breed>;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/LoadingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled, { css } from "styled-components";
import { FixedDiv } from "@/components/FixedDiv";
import { FixedDiv } from "@/layouts/FixedDiv";
import { Z_INDEX } from "@/constants/zIndex";

type Props = {
Expand Down

1 comment on commit f568e4e

@vercel
Copy link

@vercel vercel bot commented on f568e4e Feb 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.