Restyle tags

This commit is contained in:
James Grugett 2022-02-01 15:03:06 -06:00
parent d6b855f0de
commit 0a091831de
4 changed files with 12 additions and 23 deletions

View File

@ -111,7 +111,7 @@ export function CreateFoldButton() {
<label className="label"> <label className="label">
<span className="mb-1">Primary tag</span> <span className="mb-1">Primary tag</span>
</label> </label>
<TagsList noLink tags={[`#${toCamelCase(name)}`]} /> <TagsList noLink noLabel tags={[`#${toCamelCase(name)}`]} />
<Spacer h={4} /> <Spacer h={4} />
@ -134,6 +134,7 @@ export function CreateFoldButton() {
<TagsList <TagsList
tags={parseWordsAsTags(otherTags).map((tag) => `#${tag}`)} tags={parseWordsAsTags(otherTags).map((tag) => `#${tag}`)}
noLink noLink
noLabel
/> />
</div> </div>
</ConfirmationButton> </ConfirmationButton>

View File

@ -105,7 +105,7 @@ export function EditFoldButton(props: { fold: Fold; className?: string }) {
</div> </div>
<Spacer h={4} /> <Spacer h={4} />
<TagsList tags={tags.map((tag) => `#${tag}`)} noLink /> <TagsList tags={tags.map((tag) => `#${tag}`)} noLink noLabel />
<Spacer h={4} /> <Spacer h={4} />
<div className="modal-action"> <div className="modal-action">

View File

@ -4,7 +4,7 @@ import { parseWordsAsTags } from '../../common/util/parse'
import { Contract, updateContract } from '../lib/firebase/contracts' import { Contract, updateContract } from '../lib/firebase/contracts'
import { Col } from './layout/col' import { Col } from './layout/col'
import { Row } from './layout/row' import { Row } from './layout/row'
import { CompactTagsList } from './tags-list' import { TagsList } from './tags-list'
export function TagsInput(props: { contract: Contract; className?: string }) { export function TagsInput(props: { contract: Contract; className?: string }) {
const { contract, className } = props const { contract, className } = props
@ -27,7 +27,7 @@ export function TagsInput(props: { contract: Contract; className?: string }) {
return ( return (
<Col className={clsx('gap-4', className)}> <Col className={clsx('gap-4', className)}>
<CompactTagsList tags={newTags.map((tag) => `#${tag}`)} /> <TagsList tags={newTags.map((tag) => `#${tag}`)} />
<Row className="items-center gap-4"> <Row className="items-center gap-4">
<input <input

View File

@ -1,6 +1,5 @@
import clsx from 'clsx' import clsx from 'clsx'
import { Row } from './layout/row' import { Row } from './layout/row'
import { Linkify } from './linkify'
import { SiteLink } from './site-link' import { SiteLink } from './site-link'
import { Fold } from '../../common/fold' import { Fold } from '../../common/fold'
@ -9,11 +8,11 @@ export function Hashtag(props: { tag: string; noLink?: boolean }) {
const body = ( const body = (
<div <div
className={clsx( className={clsx(
'bg-white hover:bg-gray-100 px-4 py-2 rounded-full shadow-md', 'bg-gray-100 border-2 px-3 py-1 rounded-full shadow-md',
!noLink && 'cursor-pointer' !noLink && 'cursor-pointer'
)} )}
> >
<span className="text-gray-500">{tag}</span> <span className="text-gray-600 text-sm">{tag}</span>
</div> </div>
) )
@ -29,10 +28,12 @@ export function TagsList(props: {
tags: string[] tags: string[]
className?: string className?: string
noLink?: boolean noLink?: boolean
noLabel?: boolean
}) { }) {
const { tags, className, noLink } = props const { tags, className, noLink, noLabel } = props
return ( return (
<Row className={clsx('flex-wrap gap-2', className)}> <Row className={clsx('items-center flex-wrap gap-2', className)}>
{!noLabel && <div className="text-gray-500 mr-1">Tags</div>}
{tags.map((tag) => ( {tags.map((tag) => (
<Hashtag key={tag} tag={tag} noLink={noLink} /> <Hashtag key={tag} tag={tag} noLink={noLink} />
))} ))}
@ -40,19 +41,6 @@ export function TagsList(props: {
) )
} }
export function CompactTagsList(props: { tags: string[] }) {
const { tags } = props
return (
<Row className="gap-2 flex-wrap text-sm text-gray-500">
{tags.map((tag) => (
<div key={tag} className="bg-gray-100 px-1">
<Linkify text={tag} gray />
</div>
))}
</Row>
)
}
export function FoldTag(props: { fold: Fold }) { export function FoldTag(props: { fold: Fold }) {
const { fold } = props const { fold } = props
const { name } = fold const { name } = fold
@ -60,7 +48,7 @@ export function FoldTag(props: { fold: Fold }) {
<SiteLink href={`/fold/${fold.slug}`} className="flex items-center"> <SiteLink href={`/fold/${fold.slug}`} className="flex items-center">
<div <div
className={clsx( className={clsx(
'bg-indigo-50 px-4 py-2 rounded-full shadow-md', 'bg-white border-2 px-4 py-1 rounded-full shadow-md',
'cursor-pointer' 'cursor-pointer'
)} )}
> >