Skip to content

Commit

Permalink
refac: add <Section />
Browse files Browse the repository at this point in the history
  • Loading branch information
taga3s committed Aug 6, 2024
1 parent eebbc00 commit 04f3cc2
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/components/Header.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const Layout = css`
padding: 32px 20px;
display: flex;
justify-content: end;
`
`;

const Links = css`
display: flex;
gap: 24px;
`
`;

export { Layout, Links };
2 changes: 1 addition & 1 deletion app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ const Header = () => {
</ul>
</header>
);
}
};

export { Header };
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { css } from "hono/css";

const Layout = css`
margin-top: 48px;
`;
const Layout = css``;

const Header = css`
font-size: 24px;
Expand Down
20 changes: 20 additions & 0 deletions app/components/layout/Section.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { FC, JSX } from "hono/jsx";
import { Header, Layout } from "./Section.css";

type Props = {
title: string;
children: JSX.HTMLAttributes;
};

const Section: FC<Props> = (props) => {
const { title, children } = props;

return (
<section class={Layout}>
<h2 class={Header}>{title}</h2>
{children}
</section>
);
};

export { Section };
7 changes: 3 additions & 4 deletions app/components/profile/ProfileLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CosenseIcon, GitHubIcon, QiitaIcon } from "../icons";
import { Layout, Header } from "./common.css";
import { Section } from "../layout/Section";
import { Cosense, GitHub, LinkCard_Container, Qiita } from "./ProfileLinks.css";

const links = [
Expand All @@ -25,16 +25,15 @@ const links = [

const ProfileLinks = () => {
return (
<section class={Layout}>
<h2 class={Header}>Links</h2>
<Section title="Links">
<div class={LinkCard_Container}>
{links.map((link) => (
<a href={link.url} class={link.style} key={link.title}>
<div>{link.icon}</div>
</a>
))}
</div>
</section>
</Section>
);
};

Expand Down
1 change: 0 additions & 1 deletion app/components/profile/ProfileMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const ProfileMain = () => {
<div class={Main_Box}>
<span class={Main_Name}>Seiya Tagami / taga3s</span>
<ul class={Main_Belonging}>
<li>早稲田大学法学部3年</li>
<li>Web Developer (Long-term internship)</li>
</ul>
</div>
Expand Down
7 changes: 3 additions & 4 deletions app/components/profile/ProfilePhotos.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import type { FC } from "hono/jsx";
import type { Photo } from "../../api/photos";
import { Header, Layout } from "./common.css";
import { Photo_Container, Photo_Image } from "./ProfilePhotos.css";
import PhotoClickWrapper from "../../islands/PhotoClickWrapper";
import { Section } from "../layout/Section";

type Props = {
photos: Photo[];
};

const ProfilePhotos: FC<Props> = (props) => {
return (
<section class={Layout}>
<h2 class={Header}>Favorites</h2>
<Section title="Favorites">
<ul class={Photo_Container}>
{props.photos.map((image) => (
<li key={image.title}>
Expand All @@ -21,7 +20,7 @@ const ProfilePhotos: FC<Props> = (props) => {
</li>
))}
</ul>
</section>
</Section>
);
};

Expand Down
9 changes: 9 additions & 0 deletions app/components/profile/ProfilePresenter.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { css } from "hono/css";

const Layout = css`
display: flex;
flex-direction: column;
gap: 48px;
`;

export { Layout };
5 changes: 3 additions & 2 deletions app/components/profile/ProfilePresenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import { ProfileLinks } from "./ProfileLinks";
import { ProfileMain } from "./ProfileMain";
import type { Photo } from "../../api/photos/model";
import { ProfilePhotos } from "./ProfilePhotos";
import { Layout } from "./ProfilePresenter.css";

type Props = {
photos: Photo[];
};

const ProfilePresenter: FC<Props> = (props) => (
<>
<div class={Layout}>
<ProfileMain />
<ProfileLinks />
<ProfilePhotos photos={props.photos} />
</>
</div>
);

export { ProfilePresenter };
2 changes: 1 addition & 1 deletion app/routes/works.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createRoute } from "honox/factory";

export default createRoute(async (c) => {
return c.render(<div>随時掲載...</div>)
return c.render(<div>随時掲載...</div>);
});

0 comments on commit 04f3cc2

Please sign in to comment.