diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index cac1472e..d337d2e3 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -38,14 +38,14 @@ export const App: React.FC = props => { /> )} > -
{props.children} -
+ - + {/* */} ) diff --git a/src/components/ArticleCard/index.tsx b/src/components/ArticleCard/index.tsx index 82191af1..a96491b3 100644 --- a/src/components/ArticleCard/index.tsx +++ b/src/components/ArticleCard/index.tsx @@ -1,12 +1,8 @@ -import * as React from 'react' +import './styles.css' + import cx from 'classnames' import { Date } from './Date' - -interface IImage { - alt: string - src: string - srcSet: Array<{ url: string, density: number }> -} +import { IImage } from 'src/types' export interface IArticleCardProps { article: any @@ -15,86 +11,6 @@ export interface IArticleCardProps { export const ArticleCard: React.FC = ({ article, ...props }) => (
- -
{!props.preview ? null : ( diff --git a/src/components/ArticleCard/styles.css b/src/components/ArticleCard/styles.css new file mode 100644 index 00000000..551ed10c --- /dev/null +++ b/src/components/ArticleCard/styles.css @@ -0,0 +1,77 @@ +.ArticleCard { + --article-card-width: 100%; + --article-card-image-height: 15em; + --article-card-margin: var(--double-margin) var(--single-margin); + + display: flex; + flex-direction: column; + + /* margin: var(--article-card-margin); */ + width: var(--article-card-width); + /* min-width: 15em; */ + /* max-width: 20em; */ + + border-radius: 10px; + + box-shadow: 0 0 20px rgba(0, 0, 0, 0.15); + overflow: hidden; +} + +.ArticleCard > a { + display: block; + position: relative; +} + +.ArticleCard-image { + overflow: hidden; + position: relative; + width: 100%; + height: var(--article-card-image-height); +} + +.ArticleCard-image img { + width: 100%; + height: 100%; + object-fit: cover; + + transition: all 150ms ease-out; + + position: absolute; + top: 0; + left: 0; +} + +.ArticleCard-body { + z-index: 1000; + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: flex-start; + + height: 5em; + + padding: 0.75em 1em; +} + +.ArticleCard:hover img { + width: 105%; + height: 105%; + + top: -2.5%; + left: -2.5%; +} + +/* Tablet */ +@media screen and (min-width: var(--tablet-min-width)) and (max-width: var(--tablet-max-width)) { + .ArticleCard { + --article-card-image-height: 12em; + } +} + +/* Mobile */ +@media (max-width: 31.25em) { + .ArticleCard { + --article-card-width: 100%; + --article-card-margin: var(--single-margin) 0; + } +} diff --git a/src/components/ArticleCardList.tsx b/src/components/ArticleCardList.tsx index c02a264a..2af451d8 100644 --- a/src/components/ArticleCardList.tsx +++ b/src/components/ArticleCardList.tsx @@ -1,5 +1,6 @@ import { ArticleCard } from './ArticleCard' import { Pager } from './Pager' +import { CardGrid } from './CardGrid' export interface IArticleCardListProps { articles: any[] @@ -7,18 +8,13 @@ export interface IArticleCardListProps { prevPage: number | null } -export const ArticleCardList:React.FC = ({ articles, nextPage, prevPage }) => ( -
- - -
+export const ArticleCardList: React.FC = ({ articles, nextPage, prevPage }) => ( + <> + {articles.map((article, i) => { const preview = { alt: article.title, @@ -34,11 +30,11 @@ export const ArticleCardList:React.FC = ({ articles, next /> ) })} -
+ -
+ ) diff --git a/src/components/CardGrid/index.tsx b/src/components/CardGrid/index.tsx new file mode 100644 index 00000000..2357d8d3 --- /dev/null +++ b/src/components/CardGrid/index.tsx @@ -0,0 +1,13 @@ +import './styles.css' + +export type CardGridProps = { + style?: React.CSSProperties +} + +export const CardGrid: React.FC = props => { + return ( +
+ {props.children} +
+ ) +} diff --git a/src/components/CardGrid/styles.css b/src/components/CardGrid/styles.css new file mode 100644 index 00000000..e88395d0 --- /dev/null +++ b/src/components/CardGrid/styles.css @@ -0,0 +1,13 @@ +.card-grid { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + grid-gap: var(--size-xl) var(--size-l); +} + +/* .card-grid > *:first-child { + grid-row: 1 / 1; + grid-column: 1 / 1; +} */ + +@media screen and (max-width: 31.25em) { +} diff --git a/src/components/Wrapper/index.tsx b/src/components/Wrapper/index.tsx index 96c643e5..7105591c 100644 --- a/src/components/Wrapper/index.tsx +++ b/src/components/Wrapper/index.tsx @@ -21,11 +21,16 @@ export const Wrapper: React.FC = props => ( .content { flex: 1; } + + main { + display: flex; + justify-content: center; + } `} {props.header} -
+
{props.children}
diff --git a/src/style.css b/src/style.css index 5df5193a..285c06f9 100644 --- a/src/style.css +++ b/src/style.css @@ -23,10 +23,12 @@ --tablet-min-width: 31.25em; --tablet-max-width: 64em; + /* CONTENT */ --content-full: 100%; --content-wide: 90%; --content-semi-wide: 70%; --content-thin: 60%; + --content-width: var(--content-full); --embed-video-ratio: 56.25%; @@ -71,7 +73,7 @@ --size-s: 0.5em; --size-m: 1em; --size-l: 2em; - --size-xl: 5em; + --size-xl: 3em; /* EFFECTS */ --radius: 10px; diff --git a/src/style/content.scss b/src/style/content.scss index 3889e7fa..437e3889 100644 --- a/src/style/content.scss +++ b/src/style/content.scss @@ -1,25 +1,27 @@ .content { - margin: 0 auto 1em; + // margin: 0 auto 1em; - &.content_full { - width: var(--content-full); - } + width: var(--content-width); +} - &.content_wide { - width: var(--content-wide); - } +.content_full { + --content-width: var(--content-full); +} - &.content_semi-wide { - width: var(--content-semi-wide); - } +.content_wide { + --content-width: var(--content-wide); +} - &.content_thin { - width: var(--content-thin); - } +.content_semi-wide { + --content-width: var(--content-semi-wide); +} - &.content--padding-top--menu { - padding-top: var(--menu-thickness); - } +.content_thin { + --content-width: var(--content-thin); +} + +.content--padding-top--menu { + padding-top: var(--menu-thickness); } // Animation on load diff --git a/src/types.ts b/src/types.ts index 7bd31cff..5ca42726 100644 --- a/src/types.ts +++ b/src/types.ts @@ -23,3 +23,9 @@ export interface IMeta { twitterSite: string twitterCreator: string } + +export interface IImage { + alt: string + src: string + srcSet: Array<{ url: string, density: number }> +}