Skip to content

Commit

Permalink
Minor styling improvements on listing page
Browse files Browse the repository at this point in the history
  • Loading branch information
DinerIsmail committed Nov 25, 2023
1 parent 2e3938f commit f4806cf
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 30 deletions.
1 change: 0 additions & 1 deletion components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const Layout = ({
})}
alignItems="center"
flexDirection="column"
backgroundColor="gray.50"
>
{isHomepage && (
<AlertBanner
Expand Down
35 changes: 19 additions & 16 deletions components/listing/Listing.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { memo, useCallback, useEffect, useState, useMemo } from 'react'
import NextLink from 'next/link'
import { useRouter } from 'next/router'
import Image from 'next/legacy/image'
import Image from 'next/image'
import {
Box,
Heading,
Expand All @@ -19,7 +19,6 @@ import { SiFacebook, SiInstagram, SiTwitter } from 'react-icons/si'
import { ExternalLinkIcon } from '@chakra-ui/icons'
import { HiArrowLeft, HiUserGroup } from 'react-icons/hi'

import { useAppContext } from '@store/hooks'
import DescriptionRichText from '@components/main-list/description-rich-text'
import { PROTOCOL, REMOTE_HOSTNAME } from '@helpers/config'
import CategoryTag from '@components/category-tag'
Expand All @@ -30,7 +29,6 @@ import { encodeUriElements } from '@helpers/routes'
function Listing({ listing }) {
const router = useRouter()
const [subdomain, setSubdomain] = useState<string>()
const { isMobile } = useAppContext()

useEffect(() => {
const hostname = window.location.hostname
Expand Down Expand Up @@ -69,17 +67,22 @@ function Listing({ listing }) {
Back to main list
</Button>
{listing.image && (
<Image
src={listing.image}
alt={`Image for ${listing.title}`}
objectFit="cover"
height="400"
width="700"
unoptimized
style={{
borderRadius: isMobile ? 'none' : '8px',
}}
/>
<Box
borderRadius={{ base: 'none', md: '8px' }}
overflow="hidden"
position="relative"
width={{ base: '100vw', md: '700px' }}
height={{ base: '250px', md: '400px' }}
>
<Image
src={listing.image}
alt={`Image for ${listing.title}`}
sizes="(max-width: 768px) 100vw, 700px"
fill
priority
style={{ objectFit: 'cover' }}
/>
</Box>
)}
<Box px={{ base: 4, md: 2 }}>
<Flex
Expand Down Expand Up @@ -192,12 +195,12 @@ function Listing({ listing }) {
}}
>
<Tag
backgroundColor="gray.300"
backgroundColor="gray.200"
userSelect="none"
mr={1}
cursor="pointer"
transition="background-color 0.2s ease"
_hover={{ bgColor: 'gray.400' }}
_hover={{ bgColor: 'gray.300' }}
>
#{tag.label}
</Tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
ol,
ul {
font-size: 1.0625rem;
color: rgb(0 0 0 / 80%);
color: rgb(0 0 0 / 70%);
line-height: 1.6;
}

p {
Expand Down
1 change: 1 addition & 0 deletions pages/api/listing/[slug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
},
tags: {
select: {
id: true,
label: true,
},
},
Expand Down
47 changes: 35 additions & 12 deletions styles/styles.global.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
html,
body {
padding: 0;
margin: 0;
background: #F7FAFC !important;
background: #fcfcfc;
}

a {
color: inherit;
text-decoration: none;

&:hover {
text-decoration: none !important;
}
body {
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}

*, *::before, *::after {
box-sizing: border-box;
}

* {
box-sizing: border-box;
margin: 0;
font-family: Poppins, sans-serif;
font-display: swap;
font-display: swap;
}

img, picture, video, canvas, svg {
display: block;
max-width: 100%;
}

input, button, textarea, select {
font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
overflow-wrap: break-word;
}

#root, #__next {
isolation: isolate;
}

a {
color: inherit;
text-decoration: none;

&:hover {
text-decoration: none !important;
}
}

1 comment on commit f4806cf

@vercel
Copy link

@vercel vercel bot commented on f4806cf Nov 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.