From f71479965d15f17afdf4ef6db687869fd82eef7b Mon Sep 17 00:00:00 2001 From: Valerii Omelnyk Date: Sat, 26 Oct 2024 17:52:41 +0300 Subject: [PATCH] fix error reset --- src/App.scss | 38 ++++++++++++++++++-------------------- src/App.tsx | 1 + src/hooks/useComments.ts | 1 + src/hooks/usePosts.ts | 2 ++ src/hooks/useUsers.ts | 2 ++ 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/App.scss b/src/App.scss index 8832b6299..9ca74fd00 100644 --- a/src/App.scss +++ b/src/App.scss @@ -18,28 +18,26 @@ } } -@media print, screen and (min-width: 769px) { - .tile:not(.is-child) { - display: flex; - } -} - -.tile.is-ancestor:last-child { - margin-bottom: -.75rem; -} - -.tile.is-ancestor { - margin-left: -.75rem; - margin-right: -.75rem; - margin-top: -.75rem; -} - .tile { align-items: stretch; min-height: min-content; - flex-basis: 0; - flex-grow: 1; - flex-shrink: 1; + flex: 1 1 0; + + &.is-ancestor { + margin-left: -0.75rem; + margin-right: -0.75rem; + margin-top: -0.75rem; + + &:last-child { + margin-bottom: -0.75rem; + } + } + + @media print, screen and (min-width: 769px) { + &:not(.is-child) { + display: flex; + } + } } .message-body { @@ -51,4 +49,4 @@ margin: 0 auto; position: relative; width: auto; -} \ No newline at end of file +} diff --git a/src/App.tsx b/src/App.tsx index c63c29bc8..fed9f9b45 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/indent */ import 'bulma/css/bulma.css'; import '@fortawesome/fontawesome-free/css/all.css'; import cn from 'classnames'; diff --git a/src/hooks/useComments.ts b/src/hooks/useComments.ts index a51544f72..78bd9200a 100644 --- a/src/hooks/useComments.ts +++ b/src/hooks/useComments.ts @@ -9,6 +9,7 @@ export const useComments = (selectedPostId: number) => { const [isLoading, setIsLoading] = useState(false); const loadComments = () => { + setErrorMessage(''); setIsLoading(true); commentsService diff --git a/src/hooks/usePosts.ts b/src/hooks/usePosts.ts index 4380343ff..3af077c6b 100644 --- a/src/hooks/usePosts.ts +++ b/src/hooks/usePosts.ts @@ -13,6 +13,8 @@ export const usePosts = (selectedUserId: number = 0) => { return; } + setErrorMessage(''); + postsService .getUserPosts(selectedUserId) .then(setPosts) diff --git a/src/hooks/useUsers.ts b/src/hooks/useUsers.ts index 4a0cddf11..70dae7935 100644 --- a/src/hooks/useUsers.ts +++ b/src/hooks/useUsers.ts @@ -8,6 +8,8 @@ export const useUsers = () => { const [errorMessage, setErrorMessage] = useState(''); const loadUsers = () => { + setErrorMessage(''); + usersService .getUsers() .then(res => {