nicolium: migrate hashtags bar to scss

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
Assisted-by: your mother
This commit is contained in:
nicole mikołajczyk
2026-03-12 18:48:36 +01:00
parent 512ce2d391
commit 63db6c0e0b
2 changed files with 43 additions and 14 deletions

View File

@ -3,8 +3,6 @@ import { Link } from '@tanstack/react-router';
import React, { useCallback, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import Text from '../ui/text';
// Fit on a single line on desktop
const VISIBLE_HASHTAGS = 3;
@ -27,7 +25,7 @@ const HashtagsBar: React.FC<IHashtagsBar> = ({ hashtags }) => {
const revealedHashtags = expanded ? hashtags : hashtags.slice(0, VISIBLE_HASHTAGS);
return (
<div className='flex flex-wrap gap-2'>
<div className='⁂-hashtags-bar'>
{revealedHashtags.map((hashtag) => (
<Link
key={hashtag}
@ -36,23 +34,19 @@ const HashtagsBar: React.FC<IHashtagsBar> = ({ hashtags }) => {
onClick={(e) => {
e.stopPropagation();
}}
className='flex items-center rounded-sm bg-gray-100 px-1.5 py-1 text-xs font-medium text-primary-600 black:bg-primary-900 dark:bg-primary-700 dark:text-white'
className='⁂-hashtags-bar__item'
>
<Text size='xs' weight='semibold' theme='inherit'>
#<span>{hashtag}</span>
</Text>
#<span>{hashtag}</span>
</Link>
))}
{!expanded && hashtags.length > VISIBLE_HASHTAGS && (
<button onClick={handleClick}>
<Text className='hover:underline' size='xs' weight='semibold' theme='muted'>
<FormattedMessage
id='hashtags.and_other'
defaultMessage='…and {count, plural, other {# more}}'
values={{ count: hashtags.length - VISIBLE_HASHTAGS }}
/>
</Text>
<FormattedMessage
id='hashtags.and_other'
defaultMessage='…and {count, plural, other {# more}}'
values={{ count: hashtags.length - VISIBLE_HASHTAGS }}
/>
</button>
)}
</div>

View File

@ -784,3 +784,38 @@ div:has(> .⁂-timeline-status:not(.⁂-timeline-status--connected-bottom))
}
}
}
.-hashtags-bar {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
&__item {
display: flex;
align-items: center;
border-radius: 0.125rem;
background-color: rgb(var(--color-gray-100));
padding: 0.25rem 0.375rem;
font-size: 0.75rem;
line-height: 1rem;
font-weight: 500;
color: rgb(var(--color-primary-600));
.dark & {
background-color: rgb(var(--color-primary-700));
color: #fff;
}
.dark.black & {
background-color: rgb(var(--color-primary-900));
}
}
button {
@include mixins.text($theme: muted, $size: xs, $weight: semibold);
&:hover {
text-decoration: underline;
}
}
}