From 11d3a6c27410f0561de243fced241dd0347370e0 Mon Sep 17 00:00:00 2001
From: Ilya Y <75578537+ilya-bkv@users.noreply.github.com>
Date: Fri, 29 Dec 2023 09:39:16 +0300
Subject: [PATCH] Markup for mobile fix-pack (#349)
* mediaQuery context provider
* Fix header styles
* User list markup fix
---
src/components/App.tsx | 25 +++--
.../AuthorBadge/AuthorBadge.module.scss | 1 -
.../Author/AuthorBadge/AuthorBadge.tsx | 18 ++-
.../Author/AuthorCard/AuthorCard.tsx | 5 +-
src/components/Nav/Header/Header.module.scss | 4 +-
src/components/Nav/Header/Header.tsx | 12 +-
src/components/Nav/Modal/Modal.module.scss | 24 +++-
src/components/Nav/Modal/Modal.tsx | 28 ++++-
src/components/Nav/Topics/Topics.module.scss | 2 +
.../Topic/TopicBadge/TopicBadge.module.scss | 49 ++++-----
.../Topic/TopicBadge/TopicBadge.tsx | 103 +++++++++---------
src/components/Views/AllAuthors.module.scss | 5 +
.../SearchField/SearchField.module.scss | 1 +
src/context/mediaQuery.tsx | 31 ++++++
14 files changed, 198 insertions(+), 110 deletions(-)
create mode 100644 src/context/mediaQuery.tsx
diff --git a/src/components/App.tsx b/src/components/App.tsx
index f6a22fe1..7d3b3bdc 100644
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -7,6 +7,7 @@ import { Dynamic } from 'solid-js/web'
import { ConfirmProvider } from '../context/confirm'
import { EditorProvider } from '../context/editor'
import { LocalizeProvider } from '../context/localize'
+import { MediaQueryProvider } from '../context/mediaQuery'
import { NotificationsProvider } from '../context/notifications'
import { SessionProvider } from '../context/session'
import { SnackbarProvider } from '../context/snackbar'
@@ -115,17 +116,19 @@ export const App = (props: Props) => {
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
)
diff --git a/src/components/Author/AuthorBadge/AuthorBadge.module.scss b/src/components/Author/AuthorBadge/AuthorBadge.module.scss
index f119cb5d..0863304e 100644
--- a/src/components/Author/AuthorBadge/AuthorBadge.module.scss
+++ b/src/components/Author/AuthorBadge/AuthorBadge.module.scss
@@ -2,7 +2,6 @@
align-items: flex-start;
display: flex;
gap: 1rem;
- margin-bottom: 3rem;
&.nameOnly {
align-items: center;
diff --git a/src/components/Author/AuthorBadge/AuthorBadge.tsx b/src/components/Author/AuthorBadge/AuthorBadge.tsx
index b744df32..af053079 100644
--- a/src/components/Author/AuthorBadge/AuthorBadge.tsx
+++ b/src/components/Author/AuthorBadge/AuthorBadge.tsx
@@ -1,8 +1,9 @@
import { openPage } from '@nanostores/router'
import { clsx } from 'clsx'
-import { createMemo, createSignal, Match, Show, Switch } from 'solid-js'
+import { createEffect, createMemo, createSignal, Match, Show, Switch } from 'solid-js'
import { useLocalize } from '../../../context/localize'
+import { useMediaQuery } from '../../../context/mediaQuery'
import { useSession } from '../../../context/session'
import { Author, FollowingEntity } from '../../../graphql/types.gen'
import { router, useRouter } from '../../../stores/router'
@@ -23,7 +24,14 @@ type Props = {
nameOnly?: boolean
}
export const AuthorBadge = (props: Props) => {
+ const { mediaMatches } = useMediaQuery()
+ const [isMobileView, setIsMobileView] = createSignal(false)
const [isSubscribing, setIsSubscribing] = createSignal(false)
+
+ createEffect(() => {
+ setIsMobileView(!mediaMatches.sm)
+ })
+
const {
session,
subscriptions,
@@ -65,7 +73,7 @@ export const AuthorBadge = (props: Props) => {
{
fallback={