display full category

This commit is contained in:
mantikoros 2022-05-03 12:06:10 -04:00
parent b6dc281904
commit ea1cc717c3
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import clsx from 'clsx' import clsx from 'clsx'
import { CATEGORIES } from '../../common/categories'
import { Col } from './layout/col' import { Col } from './layout/col'
import { Row } from './layout/row' import { Row } from './layout/row'
@ -6,6 +7,9 @@ import { SiteLink } from './site-link'
function Hashtag(props: { tag: string; noLink?: boolean }) { function Hashtag(props: { tag: string; noLink?: boolean }) {
const { tag, noLink } = props const { tag, noLink } = props
const category = CATEGORIES[tag.replace('#', '').toLowerCase()]
console.log(tag, category)
const body = ( const body = (
<div <div
className={clsx( className={clsx(
@ -13,7 +17,7 @@ function Hashtag(props: { tag: string; noLink?: boolean }) {
!noLink && 'cursor-pointer' !noLink && 'cursor-pointer'
)} )}
> >
<span className="text-sm text-gray-600">{tag}</span> <span className="text-sm text-gray-600">{category ?? tag}</span>
</div> </div>
) )

View File

@ -213,9 +213,7 @@ export function NewContract(props: { question: string; tag?: string }) {
<select <select
className="select select-bordered w-full max-w-xs" className="select select-bordered w-full max-w-xs"
onChange={(e) => onChange={(e) =>
setCategory( setCategory(TO_CATEGORY[e.currentTarget.value] ?? '')
e.currentTarget.value || TO_CATEGORY[e.currentTarget.value]
)
} }
> >
<option selected={category === ''}></option> <option selected={category === ''}></option>