-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #811 from object1037/dev
Display post count by the tag name
- Loading branch information
Showing
7 changed files
with
341 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,37 @@ | ||
import { Link } from '@remix-run/react' | ||
import { css, cx } from 'styled-system/css' | ||
|
||
import { button } from 'styled-system/patterns' | ||
import type { getTags } from '~/.server/db' | ||
|
||
export const Tag = ({ name }: { name: string }) => { | ||
export const Tag = ({ | ||
tagData, | ||
}: { tagData: Awaited<ReturnType<typeof getTags>>[number] }) => { | ||
const tagStyle = button({ | ||
display: 'flex', | ||
py: '1.5', | ||
px: '3', | ||
gap: '2', | ||
color: 'neutral.700', | ||
borderColor: 'neutral.200', | ||
divideColor: { base: 'neutral.200', _hover: 'neutral.300' }, | ||
borderWidth: '[1px]', | ||
display: 'inline-block', | ||
color: 'neutral.700', | ||
divideX: '1px', | ||
transition: 'colors', | ||
}) | ||
const countStyle = css({ | ||
pl: '2', | ||
color: { base: 'neutral.400', _groupHover: 'neutral.500' }, | ||
}) | ||
|
||
return ( | ||
<Link to={`/tags/${name}`} prefetch="intent" className={tagStyle}> | ||
{name} | ||
<Link | ||
to={`/tags/${tagData.tagName}`} | ||
prefetch="intent" | ||
className={cx('group', tagStyle)} | ||
> | ||
<span>{tagData.tagName}</span> | ||
{tagData.count > 0 && <span className={countStyle}>{tagData.count}</span>} | ||
</Link> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.