Skip to content

Commit

Permalink
Merge pull request #8 from AlekseiBestuzhev/fix/review-edits
Browse files Browse the repository at this point in the history
Fix/review edits
  • Loading branch information
AlekseiBestuzhev committed Dec 3, 2023
2 parents ccc2579 + 076b20e commit f8df64e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Binary file added src/assets/images/default-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/features/packs/ui/pack-row/pack-row.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
padding-block: 0;

.cover {
max-width: 100px;
height: 50px;
object-fit: cover;
}

&:hover h3 {
Expand Down
3 changes: 2 additions & 1 deletion src/features/packs/ui/pack-row/pack-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Link, useNavigate } from 'react-router-dom'

import s from './pack-row.module.scss'

import defaultCover from '@/assets/images/default-image.jpg'
import { ROUTES } from '@/common/consts'
import { Button } from '@/components/ui/button'
import { Icon } from '@/components/ui/icon/icon.tsx'
Expand Down Expand Up @@ -31,7 +32,7 @@ export const PackRow: FC<Props> = memo(({ pack, authUserId }) => {
<Table.Row key={pack.id} className={s.root}>
<Table.Cell>
<Button as={Link} to={pack.id} variant="link" className={s.link}>
{pack.cover && <img src={pack.cover} alt="Pack cover" className={s.cover} />}
<img src={pack.cover || defaultCover} alt="Pack cover" className={s.cover} />
<Typography as="h3" variant="body2">
{pack.name}
</Typography>
Expand Down
8 changes: 2 additions & 6 deletions src/pages/learn/learn.module.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@import '@/styles/mixins';

.cover {
align-self: center;
width: 100%;
height: 180px;
object-fit: contain;
}

.root {
Expand All @@ -21,11 +22,6 @@

word-break: break-word;

.questionImg {
align-self: center;
height: 180px;
}

.caption {
color: var(--color-dark-100);
}
Expand Down
6 changes: 5 additions & 1 deletion src/pages/packs/packs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ export const Packs = () => {
itemsPerPage: pageSize,
})

const totalCards = packs?.data?.maxCardsCount

useEffect(() => {
setCurrentPage(1)
if (totalCards && totalCards / pageSize < currentPage) {
setCurrentPage(1)
}
}, [debouncedSearchName, debouncedSliderValue, pageSize, tabValue])

const [createDeck] = useCreateDeckMutation()
Expand Down

0 comments on commit f8df64e

Please sign in to comment.