Skip to content

Commit

Permalink
style: ๐Ÿ’„ markup the projects page
Browse files Browse the repository at this point in the history
  • Loading branch information
k1tikurisu committed Jun 25, 2021
1 parent f9adb38 commit 24e0e37
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 33 deletions.
2 changes: 1 addition & 1 deletion components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const Layout: React.FC<Props> = ({ children }) => {
return (
<div>
<Header />
<div className="container px-4 mx-auto lg:max-w-5xl lg:mt-12">
<div className="container px-4 mx-auto lg:max-w-6xl lg:mt-12">
{children}
</div>
</div>
Expand Down
24 changes: 24 additions & 0 deletions components/ProjectsList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react'
import { useProjectsQuery } from '../__generated__/types'

import { ProjectsListItem } from './ProjectsListItem'

export const ProjectsList: React.FC = () => {
const { data } = useProjectsQuery()

return (
<div className="flex flex-wrap">
{data?.projects?.map((project) => {
return (
<div key={project?.id} className="p-4 lg:w-1/3 w-full md:w-1/2">
<ProjectsListItem
id={project?.id}
title={project?.title}
image={project?.imageUrlLarge}
/>
</div>
)
})}
</div>
)
}
32 changes: 32 additions & 0 deletions components/ProjectsListItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react'
import Link from 'next/link'
import Image from 'next/image'

type Props = {
id?: string
title?: string
image?: string | null
}

export const ProjectsListItem: React.FC<Props> = ({ id, title, image }) => {
return (
<Link href={`/projects/${id}`}>
<a>
<div className="transition duration-300 bg-white shadow-md rounded-3xl group hover:shadow-lg hover:scale-105">
<Image
alt={`${title}ใฎ็”ปๅƒ`}
src={image ? image : './noImage.png'}
width={1956}
height={796}
className="object-cover object-center w-full transition duration-300 rounded-t-3xl saturate-150"
/>
<div className="p-6">
<h2 className="mb-1 text-xl font-bold text-gray-900 transition duration-300 group-hover:text-blue-500">
{title}
</h2>
</div>
</div>
</a>
</Link>
)
}
9 changes: 0 additions & 9 deletions graphql/queries/projects.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ query Projects {
projects {
id
title
whyDescription
whatDescription
howDescription
imageUrlSmall
imageUrlLarge
staffs {
id
name
avatarUrl
}
}
}
3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const config = {
reactStrictMode: true,
images: {
domains: ['d2fde157oxqkl4.cloudfront.net'],
},
}

module.exports = config
3 changes: 2 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ const App = ({ Component, pageProps }: AppProps) => {
</Head>
<DefaultSeo {...SEO} />
<style global jsx>{`
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');
body {
font-family: 'Noto Sans JP', sans-serif;
background-color: #fafafa;
}
`}</style>
<Component {...pageProps} />
Expand Down
34 changes: 12 additions & 22 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
import React from 'react'
import { Layout } from '../components/Layout'
import Link from 'next/link'
import { NextSeo } from 'next-seo'
import { useProjectsQuery } from '../generated/graphql'

const Home: React.FC = () => {
const { data, loading } = useProjectsQuery()

if (loading) {
return <div>loading...</div>
} else {
return (
<Layout>
<NextSeo
title="Wantedly"
description="Wantedly Frontend Internship ้ธ่€ƒ่ชฒ้กŒ"
/>
<div>
{!data?.projects
? null
: data.projects.map((project) => {
return <div key={project?.id}>{project?.title}</div>
})}
</div>
</Layout>
)
}
return (
<Layout>
<NextSeo
title="Wantedly"
description="Wantedly Frontend Internship ้ธ่€ƒ่ชฒ้กŒ"
/>
<Link href="/projects">
<a>ๅ‹Ÿ้›†ใƒชใ‚นใƒˆใ‚’่ฆ‹ใ‚‹</a>
</Link>
</Layout>
)
}

export default Home
19 changes: 19 additions & 0 deletions pages/projects/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import { Layout } from '../../components/Layout'
import { NextSeo } from 'next-seo'

import { ProjectsList } from '../../components/ProjectsList'

const ProjectsListPage: React.FC = () => {
return (
<Layout>
<NextSeo
title="Projects - Wantedly"
description="Wantedly Frontend Internship ้ธ่€ƒ่ชฒ้กŒ"
/>
<ProjectsList />
</Layout>
)
}

export default ProjectsListPage
Binary file added public/noImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 24e0e37

Please sign in to comment.