From d07050dff5358dd4691f2b35897540135bb5c694 Mon Sep 17 00:00:00 2001 From: kvakazyambra Date: Fri, 14 Oct 2022 21:33:06 +0300 Subject: [PATCH] Rewrite several components style to css-modules --- public/icons/instagram-white.svg | 4 + .../Author/{Card.scss => Card.module.scss} | 92 +++++- src/components/Author/Card.tsx | 42 ++- src/components/Author/Full.scss | 61 ---- src/components/Author/Full.tsx | 2 +- .../{Userpic.scss => Userpic.module.scss} | 14 + src/components/Author/Userpic.tsx | 9 +- .../Feed/{Beside.scss => Beside.module.scss} | 19 +- src/components/Feed/Beside.tsx | 16 +- .../Feed/{Card.scss => Card.module.scss} | 310 +++++++++--------- src/components/Feed/Card.tsx | 85 +++-- src/components/Feed/CardTopic.module.scss | 26 ++ src/components/Feed/CardTopic.tsx | 20 ++ src/components/Feed/Group.tsx | 36 +- src/components/Feed/Row2.tsx | 7 +- src/components/Feed/Row5.tsx | 6 +- src/components/Feed/RowShort.tsx | 7 +- src/components/Feed/Slider.scss | 14 - src/components/Feed/Slider.tsx | 7 +- src/components/Nav/Private.tsx | 5 - .../Topic/{Card.scss => Card.module.scss} | 30 +- src/components/Topic/Card.tsx | 39 ++- src/components/Views/Author.tsx | 36 +- src/components/Views/Topic.tsx | 5 +- src/styles/app.scss | 58 ++-- 25 files changed, 557 insertions(+), 393 deletions(-) create mode 100644 public/icons/instagram-white.svg rename src/components/Author/{Card.scss => Card.module.scss} (59%) rename src/components/Author/{Userpic.scss => Userpic.module.scss} (72%) rename src/components/Feed/{Beside.scss => Beside.module.scss} (81%) rename src/components/Feed/{Card.scss => Card.module.scss} (66%) create mode 100644 src/components/Feed/CardTopic.module.scss create mode 100644 src/components/Feed/CardTopic.tsx rename src/components/Topic/{Card.scss => Card.module.scss} (77%) diff --git a/public/icons/instagram-white.svg b/public/icons/instagram-white.svg new file mode 100644 index 00000000..baf59f63 --- /dev/null +++ b/public/icons/instagram-white.svg @@ -0,0 +1,4 @@ + + + diff --git a/src/components/Author/Card.scss b/src/components/Author/Card.module.scss similarity index 59% rename from src/components/Author/Card.scss rename to src/components/Author/Card.module.scss index ef1dfa4c..8400502f 100644 --- a/src/components/Author/Card.scss +++ b/src/components/Author/Card.module.scss @@ -8,30 +8,30 @@ } } -.author__details { +.authorDetails { display: flex; flex: 1; padding-right: 1.2rem; width: max-content; } -.author__details-wrapper { +.authorDetailsWrapper { flex: 1; } -.author__name { +.authorName { border: none !important; font-size: 1.7rem; font-weight: 500; margin-bottom: 0.8rem; } -.author__about { +.authorAbout { font-size: 1.5rem; color: rgb(0 0 0 / 60%); } -.author__subscribe { +.authorSubscribe { @include media-breakpoint-down(lg) { padding: 0 0 0 42px; } @@ -43,6 +43,7 @@ height: 32px; margin-right: 0.4rem; position: relative; + transition: background-color 0.2s; vertical-align: middle; width: 32px; @@ -57,8 +58,17 @@ position: absolute; top: 50%; transform: translate(-50%, -50%); + transition: filter 0.2s; width: 18px; } + + &:hover { + background: #000; + + &::before { + filter: invert(0); + } + } } a[href*='facebook.com/'] { @@ -90,9 +100,15 @@ background-image: url(/icons/tumblr-white.svg); } } + + a[href*='instagram.com/'] { + &::before { + background-image: url(/icons/instagram-white.svg); + } + } } -.button--subscribe { +.buttonSubscribe { align-items: center; aspect-ratio: 1/1; background: #f6f6f6; @@ -105,14 +121,15 @@ } } -.button__label { +.buttonLabel { display: none; } -.button--write { +.buttonWrite { background: #f7f7f7; color: #000; display: inline-flex; + @include font-size(1.5rem); .icon { @@ -123,3 +140,62 @@ height: 15px; } } + +.authorPage { + .authorName { + @include font-size(3.4rem); + + font-weight: 500; + margin-bottom: 0.2em; + } + + .authorAbout { + color: #696969; + @include font-size(1.7rem); + } + + .authorSubscribe { + display: flex; + margin-top: 2rem; + } + + .authorDetails { + display: block; + } + + .buttonLabel { + display: block; + } + + .buttonSubscribe { + aspect-ratio: auto; + background-color: #000; + border-radius: 2px; + float: none; + padding-bottom: 0.6rem; + padding-top: 0.6rem; + + .icon { + margin-right: 0.5em; + + img { + filter: invert(1); + } + } + + &:hover { + .icon img { + filter: invert(0.7); + } + } + } + + .buttonSubscribe img { + vertical-align: text-top; + } + + .button { + margin-right: 1.6rem; + vertical-align: middle; + } +} diff --git a/src/components/Author/Card.tsx b/src/components/Author/Card.tsx index 60f2275e..4931f4b3 100644 --- a/src/components/Author/Card.tsx +++ b/src/components/Author/Card.tsx @@ -2,13 +2,14 @@ import { For, Show } from 'solid-js/web' import type { Author } from '../../graphql/types.gen' import Userpic from './Userpic' import { Icon } from '../Nav/Icon' -import './Card.scss' +import style from './Card.module.scss' import { createMemo } from 'solid-js' import { translit } from '../../utils/ru2en' import { t } from '../../utils/intl' import { useAuthStore } from '../../stores/auth' import { locale } from '../../stores/ui' import { follow, unfollow } from '../../stores/zine/common' +import { clsx } from 'clsx' interface AuthorCardProps { compact?: boolean @@ -17,6 +18,7 @@ interface AuthorCardProps { hasLink?: boolean subscribed?: boolean author: Author + isAuthorPage?: boolean } export const AuthorCard = (props: AuthorCardProps) => { @@ -34,45 +36,51 @@ export const AuthorCard = (props: AuthorCardProps) => { } // TODO: reimplement AuthorCard return ( -
- +
+ -
-
+
+
- + {name()} -
{name()}
+
{name()}
-
{bio()}
+
{bio()}
-