From 54cfe7f2d0be8707a284f68d2c8d30848a4748a7 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Sun, 4 Aug 2019 20:42:59 +0300 Subject: [PATCH] ArticleCard refactoring + style update --- src/components/ArticleCard.js | 35 -------- src/components/ArticleCard.jsx | 118 ++++++++++++++++++++++++++ src/style/components/ArticleCard.scss | 97 --------------------- src/style/style.scss | 1 - 4 files changed, 118 insertions(+), 133 deletions(-) delete mode 100644 src/components/ArticleCard.js create mode 100644 src/components/ArticleCard.jsx delete mode 100644 src/style/components/ArticleCard.scss diff --git a/src/components/ArticleCard.js b/src/components/ArticleCard.js deleted file mode 100644 index c8d7a28c..00000000 --- a/src/components/ArticleCard.js +++ /dev/null @@ -1,35 +0,0 @@ -const React = require('react') -const dateFormat = require('../lib/date').dateFormat -const Image = require('./Image') - -const Date = ({children}) => ( -

{dateFormat(children)}

-) - -const Link = ({href, children}) => ( - - {children} - -) - -const ArticleCard = ({article}) => ( -
- -
- {!article.preview ? null : ( - {article.title}/ - )} -
- -
- {article.title} - - {!article.date ? null : ( - {article.date} - )} -
- -
-) - -module.exports = ArticleCard diff --git a/src/components/ArticleCard.jsx b/src/components/ArticleCard.jsx new file mode 100644 index 00000000..7d37953b --- /dev/null +++ b/src/components/ArticleCard.jsx @@ -0,0 +1,118 @@ +import React from 'react' +import { Image } from './Image' +import { dateFormat } from '../lib/date' + +const Date = ({ children }) => ( +

{dateFormat(children)}

+) + +const ArticleCard = ({ article }) => ( +
+ + + +
+ {!article.preview ? null : ( + {article.title} + )} +
+ +
+ {article.title} + + {!article.date ? null : ( + {article.date} + )} +
+
+
+) + +module.exports = ArticleCard diff --git a/src/style/components/ArticleCard.scss b/src/style/components/ArticleCard.scss deleted file mode 100644 index 7063b341..00000000 --- a/src/style/components/ArticleCard.scss +++ /dev/null @@ -1,97 +0,0 @@ -.ArticleCard { - --article-card-width: 30%; - --article-card-image-height: 15em; - --article-card-margin: var(--single-margin) var(--half-margin); - - display: flex; - flex-direction: column; - - margin: var(--article-card-margin); - width: var(--article-card-width); - min-width: 10em; - max-width: 30em; - - border: 1px solid #ccc; - border-radius: 3px; - - & > a { - display: block; - position: relative; - // height: 100%; - } -} - -.ArticleCard-image { - border-radius: 2px 2px 0 0; - - width: 100%; - height: var(--article-card-image-height); - - img { - width: 100%; - height: var(--article-card-image-height); - - object-fit: cover; - } -} - -.ArticleCard-body { - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: flex-start; - - height: 5em; - - padding: .25em .5em; -} - - -//Styling - -.ArticleCard .date { - color: #ccc; - font-size: small; -} - - -//Animation - -.ArticleCard-image { - overflow: hidden; - - img{ - transition: transform 150ms ease-out; - } -} - -.ArticleCard { - &:hover{ - img{ - transform: scale(1.05); - } - } -} - - -// Tablet - -@media screen and (min-width: var(--tablet-min-width)) and (max-width: var(--tablet-max-width)) { - .ArticleCard { - --article-card-image-height: 12em; - } - - @media screen and (orientation: portrait) { - } -} - - -// Mobile - -@media (max-width: var(--mobile-width)) { - .ArticleCard { - --article-card-width: 100%; - --article-card-margin: var(--single-margin) 0; - } -} - diff --git a/src/style/style.scss b/src/style/style.scss index 497b9898..f11c3236 100644 --- a/src/style/style.scss +++ b/src/style/style.scss @@ -20,7 +20,6 @@ @import "components/page-schedule"; @import "components/page-collective"; -@import "components/ArticleCard"; @import "components/ArticleCardList"; @import "components/ArticleTags"; @import "components/CollectiveImage";