Merge remote-tracking branch 'origin/main' into feature/351
このコミットが含まれているのは:
+3
-1
@@ -6,6 +6,7 @@ import { BrowserRouter,
|
|||||||
Routes,
|
Routes,
|
||||||
useLocation } from 'react-router-dom'
|
useLocation } from 'react-router-dom'
|
||||||
|
|
||||||
|
import DevModeWatermark from '@/components/DevModeWatermark'
|
||||||
import RouteBlockerOverlay from '@/components/RouteBlockerOverlay'
|
import RouteBlockerOverlay from '@/components/RouteBlockerOverlay'
|
||||||
import TopNav from '@/components/TopNav'
|
import TopNav from '@/components/TopNav'
|
||||||
import DialogueProvider from '@/components/dialogues/DialogueProvider'
|
import DialogueProvider from '@/components/dialogues/DialogueProvider'
|
||||||
@@ -145,6 +146,7 @@ const App: FC = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<RouteBlockerOverlay/>
|
<RouteBlockerOverlay/>
|
||||||
|
{import.meta.env.DEV && <DevModeWatermark/>}
|
||||||
|
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<DialogueProvider>
|
<DialogueProvider>
|
||||||
@@ -152,7 +154,7 @@ const App: FC = () => {
|
|||||||
<motion.div
|
<motion.div
|
||||||
layout="position"
|
layout="position"
|
||||||
transition={{ layout: { duration: .2, ease: 'easeOut' } }}
|
transition={{ layout: { duration: .2, ease: 'easeOut' } }}
|
||||||
className="flex flex-col h-dvh w-full overflow-y-hidden">
|
className="relative flex flex-col h-dvh w-full overflow-y-hidden">
|
||||||
<TopNav user={user}/>
|
<TopNav user={user}/>
|
||||||
<RouteTransitionWrapper user={user} setUser={setUser}/>
|
<RouteTransitionWrapper user={user} setUser={setUser}/>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import nikumaru from '@/assets/fonts/nikumaru.otf'
|
||||||
|
|
||||||
|
import type { FC } from 'react'
|
||||||
|
|
||||||
|
|
||||||
|
const ROW_COUNT = 8
|
||||||
|
const COLUMN_COUNT = 12
|
||||||
|
|
||||||
|
|
||||||
|
const DevModeWatermark: FC = () => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
className="pointer-events-none select-none fixed inset-0 overflow-hidden z-0">
|
||||||
|
<style>{`
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Nikumaru';
|
||||||
|
src: url(${nikumaru}) format('opentype');
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
<div className="absolute -inset-32 flex flex-col justify-center gap-12 py-48">
|
||||||
|
{Array.from ({ length: ROW_COUNT }, (_, rowIndex) => (
|
||||||
|
<div
|
||||||
|
key={rowIndex}
|
||||||
|
className={
|
||||||
|
'flex min-h-32 items-center gap-12 '
|
||||||
|
+ (rowIndex % 2 === 0 ? 'translate-x-0' : 'translate-x-32')
|
||||||
|
}>
|
||||||
|
{Array.from ({ length: COLUMN_COUNT }, (_, columnIndex) => (
|
||||||
|
<span
|
||||||
|
key={columnIndex}
|
||||||
|
className={
|
||||||
|
'whitespace-nowrap text-3xl font-bold '
|
||||||
|
+ 'tracking-[0.3em] text-neutral-950/5 '
|
||||||
|
+ 'dark:text-white/10'
|
||||||
|
}
|
||||||
|
style={{ fontFamily: 'Nikumaru' }}>
|
||||||
|
開発モード
|
||||||
|
</span>))}
|
||||||
|
</div>))}
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default DevModeWatermark
|
||||||
@@ -87,10 +87,13 @@ const DraggableDroppableTagRow: FC<Props> = ({ tag, nestLevel, pathKey, parentTa
|
|||||||
setDropRef (node)
|
setDropRef (node)
|
||||||
}}
|
}}
|
||||||
style={style}
|
style={style}
|
||||||
className={cn ('rounded select-none', over && 'ring-2 ring-offset-2')}
|
className={cn (
|
||||||
|
'min-w-0 max-w-full overflow-hidden rounded select-none',
|
||||||
|
over && 'ring-2 ring-offset-2')}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}>
|
{...listeners}>
|
||||||
<motion.div
|
<motion.div
|
||||||
|
className="flex min-w-0 max-w-full items-baseline overflow-hidden"
|
||||||
transition={{ layout: { duration: .2, ease: 'easeOut' } }}
|
transition={{ layout: { duration: .2, ease: 'easeOut' } }}
|
||||||
layoutId={`tag-${ sp ? 'sp-' : '' }${ tag.id }`}>
|
layoutId={`tag-${ sp ? 'sp-' : '' }${ tag.id }`}>
|
||||||
<TagLink tag={tag} nestLevel={nestLevel}/>
|
<TagLink tag={tag} nestLevel={nestLevel}/>
|
||||||
|
|||||||
@@ -318,12 +318,20 @@ const MobileMaterialTreeNode: FC<{ depth?: number
|
|||||||
<TagLink
|
<TagLink
|
||||||
tag={sidebarTagToTag (tag)}
|
tag={sidebarTagToTag (tag)}
|
||||||
title={tag.name}
|
title={tag.name}
|
||||||
|
truncateOnMobile
|
||||||
withCount={false}
|
withCount={false}
|
||||||
withWiki={false}
|
withWiki={false}
|
||||||
to={materialPath (tag.id, materialFilter)}
|
to={materialPath (tag.id, materialFilter)}
|
||||||
className="block overflow-hidden text-ellipsis whitespace-nowrap
|
className="block overflow-hidden text-ellipsis whitespace-nowrap
|
||||||
[max-inline-size:var(--tag-link-inline-size)]
|
[max-inline-size:var(--tag-link-inline-size)]
|
||||||
[max-height:var(--tag-link-inline-size)]"/>
|
[max-height:var(--tag-link-inline-size)]
|
||||||
|
[&_.tag-marquee]:block
|
||||||
|
[&_.tag-marquee]:h-full
|
||||||
|
[&_.tag-marquee]:overflow-hidden
|
||||||
|
[&_.tag-marquee__static]:h-full
|
||||||
|
[&_.tag-marquee__static]:overflow-hidden
|
||||||
|
[&_.tag-marquee__static]:text-ellipsis
|
||||||
|
[&_.tag-marquee__static]:[text-overflow:ellipsis]"/>
|
||||||
</div>
|
</div>
|
||||||
{tag.hasChildren && (
|
{tag.hasChildren && (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -0,0 +1,250 @@
|
|||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { useEffect, useRef, useState } from 'react'
|
||||||
|
|
||||||
|
import type { FC } from 'react'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
text: string
|
||||||
|
className?: string
|
||||||
|
truncateOnMobile?: boolean
|
||||||
|
title?: string }
|
||||||
|
|
||||||
|
const DESKTOP_MARQUEE_MEDIA =
|
||||||
|
'(min-width: 768px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference)'
|
||||||
|
const MARQUEE_START_DELAY_MS = 1600
|
||||||
|
const MARQUEE_END_HOLD_MS = 2400
|
||||||
|
const MARQUEE_SCROLL_PX_PER_SECOND = 43
|
||||||
|
const MIN_MARQUEE_OVERFLOW_PX = 1
|
||||||
|
|
||||||
|
|
||||||
|
const ResponsiveMarqueeText: FC<Props> = (
|
||||||
|
{ text, className, truncateOnMobile = false, title },
|
||||||
|
) => {
|
||||||
|
const outerRef = useRef<HTMLSpanElement | null> (null)
|
||||||
|
const staticRef = useRef<HTMLSpanElement | null> (null)
|
||||||
|
const animatedRef = useRef<HTMLSpanElement | null> (null)
|
||||||
|
const animationRef = useRef<Animation | null> (null)
|
||||||
|
const timeoutRef = useRef<number | null> (null)
|
||||||
|
const rafRef = useRef<number | null> (null)
|
||||||
|
const [overflowPx, setOverflowPx] = useState (0)
|
||||||
|
const [desktopMarqueeEnabled, setDesktopMarqueeEnabled] = useState (false)
|
||||||
|
const [active, setActive] = useState (false)
|
||||||
|
const [marqueeVisible, setMarqueeVisible] = useState (false)
|
||||||
|
|
||||||
|
useEffect (() => {
|
||||||
|
const outer = outerRef.current
|
||||||
|
const inner = staticRef.current
|
||||||
|
|
||||||
|
if (!(outer) || !(inner))
|
||||||
|
return
|
||||||
|
|
||||||
|
const measure = () => {
|
||||||
|
const nextOverflow = Math.max (0, Math.ceil (inner.scrollWidth - outer.clientWidth))
|
||||||
|
setOverflowPx (prev => Math.abs (prev - nextOverflow) <= 1 ? prev : nextOverflow)
|
||||||
|
}
|
||||||
|
|
||||||
|
measure ()
|
||||||
|
|
||||||
|
const resizeObserver =
|
||||||
|
typeof ResizeObserver === 'undefined'
|
||||||
|
? null
|
||||||
|
: new ResizeObserver (() => {
|
||||||
|
measure ()
|
||||||
|
})
|
||||||
|
|
||||||
|
resizeObserver?.observe (outer)
|
||||||
|
resizeObserver?.observe (inner)
|
||||||
|
addEventListener ('resize', measure)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
resizeObserver?.disconnect ()
|
||||||
|
removeEventListener ('resize', measure)
|
||||||
|
}
|
||||||
|
}, [text])
|
||||||
|
|
||||||
|
useEffect (() => {
|
||||||
|
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
||||||
|
return
|
||||||
|
|
||||||
|
const media = window.matchMedia (DESKTOP_MARQUEE_MEDIA)
|
||||||
|
const update = () => {
|
||||||
|
setDesktopMarqueeEnabled (media.matches)
|
||||||
|
}
|
||||||
|
|
||||||
|
update ()
|
||||||
|
media.addEventListener ('change', update)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
media.removeEventListener ('change', update)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect (() => {
|
||||||
|
const clearScheduled = () => {
|
||||||
|
if (timeoutRef.current != null)
|
||||||
|
{
|
||||||
|
clearTimeout (timeoutRef.current)
|
||||||
|
timeoutRef.current = null
|
||||||
|
}
|
||||||
|
if (rafRef.current != null)
|
||||||
|
{
|
||||||
|
cancelAnimationFrame (rafRef.current)
|
||||||
|
rafRef.current = null
|
||||||
|
}
|
||||||
|
animationRef.current?.cancel ()
|
||||||
|
animationRef.current = null
|
||||||
|
}
|
||||||
|
|
||||||
|
const animated = animatedRef.current
|
||||||
|
const canMarquee = (
|
||||||
|
active
|
||||||
|
&& desktopMarqueeEnabled
|
||||||
|
&& overflowPx >= MIN_MARQUEE_OVERFLOW_PX
|
||||||
|
&& animated != null)
|
||||||
|
|
||||||
|
const resetAnimated = () => {
|
||||||
|
const node = animatedRef.current
|
||||||
|
|
||||||
|
animationRef.current?.cancel ()
|
||||||
|
animationRef.current = null
|
||||||
|
node?.getAnimations?.().forEach (animation => {
|
||||||
|
animation.cancel ()
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!(node))
|
||||||
|
return
|
||||||
|
|
||||||
|
node.style.transition = 'none'
|
||||||
|
node.style.transform = 'translateX(0)'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!canMarquee)
|
||||||
|
{
|
||||||
|
clearScheduled ()
|
||||||
|
resetAnimated ()
|
||||||
|
setMarqueeVisible (false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let cancelled = false
|
||||||
|
|
||||||
|
const sleep = (ms: number) =>
|
||||||
|
new Promise<void> (resolve => {
|
||||||
|
timeoutRef.current = window.setTimeout (() => {
|
||||||
|
timeoutRef.current = null
|
||||||
|
resolve ()
|
||||||
|
}, ms)
|
||||||
|
})
|
||||||
|
|
||||||
|
const runLoop = async () => {
|
||||||
|
while (!cancelled)
|
||||||
|
{
|
||||||
|
resetAnimated ()
|
||||||
|
setMarqueeVisible (true)
|
||||||
|
|
||||||
|
await sleep (MARQUEE_START_DELAY_MS)
|
||||||
|
if (cancelled || !(animatedRef.current))
|
||||||
|
break
|
||||||
|
|
||||||
|
const moveDurationMs =
|
||||||
|
overflowPx / MARQUEE_SCROLL_PX_PER_SECOND * 1000
|
||||||
|
const node = animatedRef.current
|
||||||
|
|
||||||
|
if (typeof node.animate === 'function')
|
||||||
|
{
|
||||||
|
const animation = node.animate (
|
||||||
|
[
|
||||||
|
{ transform: 'translateX(0)' },
|
||||||
|
{ transform: `translateX(-${ overflowPx }px)` },
|
||||||
|
],
|
||||||
|
{ duration: moveDurationMs, easing: 'linear', fill: 'forwards' })
|
||||||
|
animationRef.current = animation
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await animation.finished
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
node.style.transform = `translateX(-${ overflowPx }px)`
|
||||||
|
animation.cancel ()
|
||||||
|
if (animationRef.current === animation)
|
||||||
|
animationRef.current = null
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node.style.transition = `transform ${ moveDurationMs }ms linear`
|
||||||
|
await new Promise<void> (resolve => {
|
||||||
|
rafRef.current = requestAnimationFrame (() => {
|
||||||
|
rafRef.current = null
|
||||||
|
node.style.transform = `translateX(-${ overflowPx }px)`
|
||||||
|
resolve ()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
await sleep (moveDurationMs)
|
||||||
|
node.style.transition = 'none'
|
||||||
|
node.style.transform = `translateX(-${ overflowPx }px)`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cancelled)
|
||||||
|
break
|
||||||
|
|
||||||
|
await sleep (MARQUEE_END_HOLD_MS)
|
||||||
|
if (cancelled)
|
||||||
|
break
|
||||||
|
|
||||||
|
resetAnimated ()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void runLoop ()
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
cancelled = true
|
||||||
|
clearScheduled ()
|
||||||
|
resetAnimated ()
|
||||||
|
setMarqueeVisible (false)
|
||||||
|
}
|
||||||
|
}, [active, desktopMarqueeEnabled, overflowPx, text])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
ref={outerRef}
|
||||||
|
title={title ?? text}
|
||||||
|
onMouseEnter={() => setActive (true)}
|
||||||
|
onMouseLeave={() => setActive (false)}
|
||||||
|
onFocus={() => setActive (true)}
|
||||||
|
onBlur={() => setActive (false)}
|
||||||
|
className={cn (
|
||||||
|
'tag-marquee inline-block max-w-full min-w-0 align-bottom',
|
||||||
|
(truncateOnMobile
|
||||||
|
? 'overflow-hidden text-ellipsis whitespace-nowrap'
|
||||||
|
: 'whitespace-normal [overflow-wrap:anywhere]'),
|
||||||
|
'md:overflow-hidden md:whitespace-nowrap',
|
||||||
|
className)}>
|
||||||
|
<span
|
||||||
|
ref={staticRef}
|
||||||
|
className={cn (
|
||||||
|
'tag-marquee__static block max-w-full',
|
||||||
|
(truncateOnMobile
|
||||||
|
? 'overflow-hidden text-ellipsis whitespace-nowrap'
|
||||||
|
: 'whitespace-normal [overflow-wrap:anywhere]'),
|
||||||
|
'md:overflow-hidden md:text-ellipsis md:whitespace-nowrap',
|
||||||
|
marqueeVisible && 'md:opacity-0')}>
|
||||||
|
{text}
|
||||||
|
</span>
|
||||||
|
{overflowPx >= MIN_MARQUEE_OVERFLOW_PX && (
|
||||||
|
<span
|
||||||
|
ref={animatedRef}
|
||||||
|
aria-hidden="true"
|
||||||
|
className={cn (
|
||||||
|
'tag-marquee__animated hidden md:block',
|
||||||
|
marqueeVisible ? 'md:opacity-100' : 'md:opacity-0')}>
|
||||||
|
{text}
|
||||||
|
</span>)}
|
||||||
|
</span>)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ResponsiveMarqueeText
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import PrefetchLink from '@/components/PrefetchLink'
|
import PrefetchLink from '@/components/PrefetchLink'
|
||||||
|
import ResponsiveMarqueeText from '@/components/ResponsiveMarqueeText'
|
||||||
import { LIGHT_COLOUR_SHADE, DARK_COLOUR_SHADE, TAG_COLOUR } from '@/consts'
|
import { LIGHT_COLOUR_SHADE, DARK_COLOUR_SHADE, TAG_COLOUR } from '@/consts'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ import type { Tag } from '@/types'
|
|||||||
type CommonProps = {
|
type CommonProps = {
|
||||||
tag: Tag
|
tag: Tag
|
||||||
nestLevel?: number
|
nestLevel?: number
|
||||||
|
truncateOnMobile?: boolean
|
||||||
withWiki?: boolean
|
withWiki?: boolean
|
||||||
withCount?: boolean }
|
withCount?: boolean }
|
||||||
|
|
||||||
@@ -30,9 +32,11 @@ type Props =
|
|||||||
const TagLink: FC<Props> = ({ tag,
|
const TagLink: FC<Props> = ({ tag,
|
||||||
nestLevel = 0,
|
nestLevel = 0,
|
||||||
linkFlg = true,
|
linkFlg = true,
|
||||||
|
truncateOnMobile = false,
|
||||||
withWiki = true,
|
withWiki = true,
|
||||||
withCount = true,
|
withCount = true,
|
||||||
className,
|
className,
|
||||||
|
title,
|
||||||
...props }) => {
|
...props }) => {
|
||||||
const spanClass = cn (
|
const spanClass = cn (
|
||||||
`text-${ TAG_COLOUR[tag.category] }-${ LIGHT_COLOUR_SHADE }`,
|
`text-${ TAG_COLOUR[tag.category] }-${ LIGHT_COLOUR_SHADE }`,
|
||||||
@@ -41,11 +45,18 @@ const TagLink: FC<Props> = ({ tag,
|
|||||||
spanClass,
|
spanClass,
|
||||||
`hover:text-${ TAG_COLOUR[tag.category] }-${ LIGHT_COLOUR_SHADE - 200 }`,
|
`hover:text-${ TAG_COLOUR[tag.category] }-${ LIGHT_COLOUR_SHADE - 200 }`,
|
||||||
`dark:hover:text-${ TAG_COLOUR[tag.category] }-${ DARK_COLOUR_SHADE - 200 }`)
|
`dark:hover:text-${ TAG_COLOUR[tag.category] }-${ DARK_COLOUR_SHADE - 200 }`)
|
||||||
|
const textClass = 'group min-w-0 max-w-full overflow-hidden align-bottom'
|
||||||
|
const rootClass =
|
||||||
|
'inline-flex min-w-0 max-w-full flex-nowrap items-stretch align-baseline gap-x-1 md:items-baseline'
|
||||||
|
const markerWrapClass = 'shrink-0 self-start md:self-auto'
|
||||||
|
const countClass = 'shrink-0 self-end md:self-auto'
|
||||||
|
const textTitle = title
|
||||||
|
?? (tag.matchedAlias == null ? tag.name : `${ tag.matchedAlias } → ${ tag.name }`)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<span className={rootClass}>
|
||||||
{(linkFlg && withWiki) && (
|
{(linkFlg && withWiki) && (
|
||||||
<span className="mr-1">
|
<span className={markerWrapClass}>
|
||||||
{(tag.materialId != null || tag.hasWiki || tag.hasDeerjikists)
|
{(tag.materialId != null || tag.hasWiki || tag.hasDeerjikists)
|
||||||
? (
|
? (
|
||||||
tag.materialId == null && !(tag.hasDeerjikists)
|
tag.materialId == null && !(tag.hasDeerjikists)
|
||||||
@@ -100,33 +111,48 @@ const TagLink: FC<Props> = ({ tag,
|
|||||||
</span>)}
|
</span>)}
|
||||||
{nestLevel > 0 && (
|
{nestLevel > 0 && (
|
||||||
<span
|
<span
|
||||||
className="ml-1 mr-1"
|
className="ml-1 mr-1 shrink-0"
|
||||||
style={{ paddingLeft: `${ (nestLevel - 1) }rem` }}>
|
style={{ paddingLeft: `${ (nestLevel - 1) }rem` }}>
|
||||||
↳
|
↳
|
||||||
</span>)}
|
</span>)}
|
||||||
{tag.matchedAlias != null && (
|
{tag.matchedAlias != null && (
|
||||||
<>
|
<>
|
||||||
<span className={cn (spanClass, className)} {...props}>
|
<span
|
||||||
{tag.matchedAlias}
|
title={textTitle}
|
||||||
|
className={cn (spanClass, textClass, className)}
|
||||||
|
{...props}>
|
||||||
|
<ResponsiveMarqueeText
|
||||||
|
text={tag.matchedAlias}
|
||||||
|
title={textTitle}
|
||||||
|
truncateOnMobile={truncateOnMobile}/>
|
||||||
</span>
|
</span>
|
||||||
<> → </>
|
<span className="shrink-0"> → </span>
|
||||||
</>)}
|
</>)}
|
||||||
{linkFlg
|
{linkFlg
|
||||||
? (
|
? (
|
||||||
<PrefetchLink
|
<PrefetchLink
|
||||||
to={`/posts?${ (new URLSearchParams ({ tags: tag.name })).toString () }`}
|
to={`/posts?${ (new URLSearchParams ({ tags: tag.name })).toString () }`}
|
||||||
className={cn (linkClass, className)}
|
title={textTitle}
|
||||||
|
className={cn (linkClass, textClass, className)}
|
||||||
{...props}>
|
{...props}>
|
||||||
{tag.name}
|
<ResponsiveMarqueeText
|
||||||
|
text={tag.name}
|
||||||
|
title={textTitle}
|
||||||
|
truncateOnMobile={truncateOnMobile}/>
|
||||||
</PrefetchLink>)
|
</PrefetchLink>)
|
||||||
: (
|
: (
|
||||||
<span className={cn (spanClass, className)}
|
<span
|
||||||
|
title={textTitle}
|
||||||
|
className={cn (spanClass, textClass, className)}
|
||||||
{...props}>
|
{...props}>
|
||||||
{tag.name}
|
<ResponsiveMarqueeText
|
||||||
|
text={tag.name}
|
||||||
|
title={textTitle}
|
||||||
|
truncateOnMobile={truncateOnMobile}/>
|
||||||
</span>)}
|
</span>)}
|
||||||
{withCount && (
|
{withCount && (
|
||||||
<span className="ml-1">{tag.postCount}</span>)}
|
<span className={countClass}>{tag.postCount}</span>)}
|
||||||
</>)
|
</span>)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TagLink
|
export default TagLink
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ const TagSearchBox: FC<Props> = ({ suggestions, activeIndex, onSelect }) => {
|
|||||||
rounded shadow">
|
rounded shadow">
|
||||||
{suggestions.map ((tag, i) => (
|
{suggestions.map ((tag, i) => (
|
||||||
<li key={tag.id}
|
<li key={tag.id}
|
||||||
className={cn ('px-3 py-2 cursor-pointer hover:bg-gray-300 dark:hover:bg-gray-700',
|
className={cn ('min-w-0 overflow-hidden px-3 py-2 cursor-pointer hover:bg-gray-300 dark:hover:bg-gray-700',
|
||||||
i === activeIndex && 'bg-gray-300 dark:bg-gray-700')}
|
i === activeIndex && 'bg-gray-300 dark:bg-gray-700')}
|
||||||
onMouseDown={() => onSelect (tag)}>
|
onMouseDown={() => onSelect (tag)}>
|
||||||
<TagLink tag={tag} linkFlg={false} withWiki={false}/>
|
<div className="flex min-w-0 max-w-full items-baseline overflow-hidden">
|
||||||
|
<TagLink tag={tag} linkFlg={false} withWiki={false}/>
|
||||||
|
</div>
|
||||||
</li>))}
|
</li>))}
|
||||||
</ul>)
|
</ul>)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ const TagSidebar: FC<Props> = ({ posts, onClick }) => {
|
|||||||
<ul>
|
<ul>
|
||||||
{CATEGORIES.flatMap (cat => cat in tags ? (
|
{CATEGORIES.flatMap (cat => cat in tags ? (
|
||||||
tags[cat].map (tag => (
|
tags[cat].map (tag => (
|
||||||
<li key={tag.id} className="mb-1">
|
<li key={tag.id} className="mb-1 min-w-0 max-w-full overflow-hidden">
|
||||||
<motion.div
|
<motion.div
|
||||||
|
className="flex min-w-0 max-w-full items-baseline overflow-hidden"
|
||||||
transition={{ layout: { duration: .2, ease: 'easeOut' } }}
|
transition={{ layout: { duration: .2, ease: 'easeOut' } }}
|
||||||
layoutId={`tag-${ tag.id }`}>
|
layoutId={`tag-${ tag.id }`}>
|
||||||
<TagLink tag={tag} onClick={onClick}/>
|
<TagLink tag={tag} onClick={onClick}/>
|
||||||
|
|||||||
@@ -132,3 +132,20 @@ body
|
|||||||
0%, 100% { color: #f87171; }
|
0%, 100% { color: #f87171; }
|
||||||
50% { color: #60a5fa; }
|
50% { color: #60a5fa; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tag-marquee
|
||||||
|
{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-marquee__animated
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
inset: 0 auto 0 0;
|
||||||
|
min-width: 100%;
|
||||||
|
width: max-content;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
will-change: transform;
|
||||||
|
}
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする