From 432ad76b3bb56a7cd34d7c159773fd447ccbc14f Mon Sep 17 00:00:00 2001 From: Alex Zoitos Date: Tue, 8 Sep 2020 20:47:46 -0400 Subject: [PATCH] Titlecard Component (#56) * feat(titlecard): initial titleCard * fix(frontend): fix aspect ratio of titlecard * style(frontend): title card styling - transition effect * refactor(frontend): title card props - showDetail change Co-authored-by: sct --- src/components/TitleCard/index.tsx | 96 ++++++++++++++++++++++++++++++ src/pages/index.tsx | 17 ++++-- src/styles/globals.css | 5 ++ 3 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 src/components/TitleCard/index.tsx diff --git a/src/components/TitleCard/index.tsx b/src/components/TitleCard/index.tsx new file mode 100644 index 000000000..710d3aed9 --- /dev/null +++ b/src/components/TitleCard/index.tsx @@ -0,0 +1,96 @@ +import React, { useState } from 'react'; +import Transition from '../Transition'; + +interface TitleCardProps { + image: string; + summary: string; + year: string; + title: string; + userScore: number; + + //TODO - change to ENUM + status: string; +} + +const TitleCard: React.FC = ({ + image, + summary, + year, + title, + userScore, + status, +}) => { + const [showDetail, setShowDetail] = useState(false); + + return ( +
+
setShowDetail(true)} + onMouseLeave={() => setShowDetail(false)} + > +
+ +
+
+
+ {year} +
+ +

+ {title} +

+
+ {summary} +
+ +
+ + Status: {status} + + + + User Score: {userScore}/100 + +
+
+ +
+
+
+
+
+ ); +}; + +export default TitleCard; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index b75500526..9cebb384a 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,12 +1,19 @@ import React from 'react'; -import { NextPage } from 'next'; +import type { NextPage } from 'next'; +import TitleCard from '../components/TitleCard'; const Index: NextPage = () => { return ( -
-

Overseer

-

Here is some text

-
+ <> + + ); }; diff --git a/src/styles/globals.css b/src/styles/globals.css index 1fe682ded..32d727415 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -6,3 +6,8 @@ @apply inline-flex items-center px-4 py-2 border border-transparent text-sm leading-5 font-medium rounded-md text-white bg-indigo-600 transition ease-in-out duration-150; background-color: #cc7b19; } + +.titleCard { + @apply relative bg-cover rounded-lg; + padding-bottom: 150%; +}