F: Improve hover buttons design

This commit is contained in:
Ivan 2025-06-17 22:28:56 +03:00
parent aaf4bf275e
commit 4759abd03f
12 changed files with 24 additions and 18 deletions

View File

@ -40,7 +40,7 @@ export function Button({
className={cn( className={cn(
'inline-flex gap-2 items-center justify-center', 'inline-flex gap-2 items-center justify-center',
'font-medium select-none disabled:cursor-auto disabled:opacity-75', 'font-medium select-none disabled:cursor-auto disabled:opacity-75',
'bg-secondary text-secondary-foreground cc-hover cc-animate-color', 'bg-secondary text-secondary-foreground cc-hover-bg cc-animate-color',
dense ? 'px-1' : 'px-3 py-1', dense ? 'px-1' : 'px-3 py-1',
loading ? 'cursor-progress' : 'cursor-pointer', loading ? 'cursor-progress' : 'cursor-pointer',
noOutline ? 'outline-hidden focus-visible:bg-selected' : 'focus-outline', noOutline ? 'outline-hidden focus-visible:bg-selected' : 'focus-outline',

View File

@ -41,7 +41,7 @@ export function MiniButton({
'rounded-lg', 'rounded-lg',
'cc-controls cc-animate-background', 'cc-controls cc-animate-background',
'cursor-pointer disabled:cursor-auto', 'cursor-pointer disabled:cursor-auto',
noHover ? 'outline-hidden' : 'cc-hover', noHover ? 'outline-hidden' : 'cc-hover-bg',
!noPadding && 'px-1 py-1', !noPadding && 'px-1 py-1',
className className
)} )}

View File

@ -32,7 +32,7 @@ export function SelectorButton({
'text-sm font-controls select-none', 'text-sm font-controls select-none',
'text-btn cc-controls', 'text-btn cc-controls',
'disabled:cursor-auto cursor-pointer', 'disabled:cursor-auto cursor-pointer',
'cc-hover cc-animate-color', 'cc-hover-text cc-animate-color',
className className
)} )}
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined} data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}

View File

@ -36,7 +36,7 @@ export function PaginationTools<TData>({
<button <button
type='button' type='button'
aria-label='Первая страница' aria-label='Первая страница'
className='cc-hover cc-controls cc-animate-color focus-outline' className='cc-hover-bg cc-controls cc-animate-color focus-outline'
onClick={() => table.setPageIndex(0)} onClick={() => table.setPageIndex(0)}
disabled={!table.getCanPreviousPage()} disabled={!table.getCanPreviousPage()}
> >
@ -45,7 +45,7 @@ export function PaginationTools<TData>({
<button <button
type='button' type='button'
aria-label='Предыдущая страница' aria-label='Предыдущая страница'
className='cc-hover cc-controls cc-animate-color focus-outline' className='cc-hover-bg cc-controls cc-animate-color focus-outline'
onClick={() => table.previousPage()} onClick={() => table.previousPage()}
disabled={!table.getCanPreviousPage()} disabled={!table.getCanPreviousPage()}
> >
@ -55,7 +55,7 @@ export function PaginationTools<TData>({
id={id ? `${id}__page` : undefined} id={id ? `${id}__page` : undefined}
title='Номер страницы. Выделите для ручного ввода' title='Номер страницы. Выделите для ручного ввода'
aria-label='Номер страницы' aria-label='Номер страницы'
className='w-6 text-center bg-transparent focus-outline' className='w-6 text-center bg-transparent focus-outline rounded-md'
value={table.getState().pagination.pageIndex + 1} value={table.getState().pagination.pageIndex + 1}
onChange={event => { onChange={event => {
const page = event.target.value ? Number(event.target.value) - 1 : 0; const page = event.target.value ? Number(event.target.value) - 1 : 0;
@ -67,7 +67,7 @@ export function PaginationTools<TData>({
<button <button
type='button' type='button'
aria-label='Следующая страница' aria-label='Следующая страница'
className='cc-hover cc-controls cc-animate-color focus-outline' className='cc-hover-bg cc-controls cc-animate-color focus-outline'
onClick={() => table.nextPage()} onClick={() => table.nextPage()}
disabled={!table.getCanNextPage()} disabled={!table.getCanNextPage()}
> >
@ -76,7 +76,7 @@ export function PaginationTools<TData>({
<button <button
type='button' type='button'
aria-label='Последняя страница' aria-label='Последняя страница'
className='cc-hover cc-controls cc-animate-color focus-outline' className='cc-hover-bg cc-controls cc-animate-color focus-outline'
onClick={() => table.setPageIndex(table.getPageCount() - 1)} onClick={() => table.setPageIndex(table.getPageCount() - 1)}
disabled={!table.getCanNextPage()} disabled={!table.getCanNextPage()}
> >

View File

@ -70,7 +70,7 @@ export function TableRow<TData>({
<tr <tr
className={cn( className={cn(
'cc-scroll-row', 'cc-scroll-row',
'cc-hover cc-animate-background duration-fade', 'cc-hover-bg cc-animate-background duration-fade',
!noHeader && 'scroll-mt-[calc(2px+2rem)]', !noHeader && 'scroll-mt-[calc(2px+2rem)]',
table.options.enableRowSelection && row.getIsSelected() table.options.enableRowSelection && row.getIsSelected()
? 'cc-selected' ? 'cc-selected'

View File

@ -38,7 +38,7 @@ export function DropdownButton({
'text-left text-sm text-ellipsis whitespace-nowrap', 'text-left text-sm text-ellipsis whitespace-nowrap',
'disabled:cc-controls disabled:opacity-75', 'disabled:cc-controls disabled:opacity-75',
'focus-outline cc-animate-background', 'focus-outline cc-animate-background',
!!onClick ? 'cc-hover cursor-pointer disabled:cursor-auto' : 'bg-secondary text-secondary-foreground', !!onClick ? 'cc-hover-bg cursor-pointer disabled:cursor-auto' : 'bg-secondary text-secondary-foreground',
className className
)} )}
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined} data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}

View File

@ -90,7 +90,7 @@ export function SelectTree<ItemType>({
<div <div
key={`${prefix}${index}`} key={`${prefix}${index}`}
className={clsx( className={clsx(
'cc-tree-item relative cc-scroll-row cc-hover', 'cc-tree-item relative cc-scroll-row cc-hover-bg',
isActive ? 'max-h-7 py-1 border-b' : 'max-h-0 opacity-0 pointer-events-none', isActive ? 'max-h-7 py-1 border-b' : 'max-h-0 opacity-0 pointer-events-none',
value === item && 'cc-selected' value === item && 'cc-selected'
)} )}

View File

@ -33,7 +33,7 @@ export function TabLabel({
'text-sm whitespace-nowrap font-controls', 'text-sm whitespace-nowrap font-controls',
'select-none', 'select-none',
'outline-hidden', 'outline-hidden',
!disabled && 'hover:cursor-pointer cc-hover', !disabled && 'hover:cursor-pointer cc-hover-bg',
disabled && 'text-muted-foreground', disabled && 'text-muted-foreground',
className className
)} )}

View File

@ -62,7 +62,7 @@ export function SelectLocation({ value, dense, prefix, onClick, className, style
!dense && 'h-7 sm:h-8', !dense && 'h-7 sm:h-8',
'pr-3 py-1 flex items-center gap-2', 'pr-3 py-1 flex items-center gap-2',
'cc-scroll-row', 'cc-scroll-row',
'cc-hover cc-animate-color duration-fade', 'cc-hover-bg cc-animate-color duration-fade',
'cursor-pointer', 'cursor-pointer',
'leading-3 sm:leading-4', 'leading-3 sm:leading-4',
activeNode === item && 'cc-selected' activeNode === item && 'cc-selected'

View File

@ -33,8 +33,8 @@ export function RSLocalButton({
className={clsx( className={clsx(
'w-7 sm:w-8 h-5 sm:h-6', 'w-7 sm:w-8 h-5 sm:h-6',
'cursor-pointer disabled:cursor-default', 'cursor-pointer disabled:cursor-default',
'rounded-none', 'rounded-md',
'cc-hover cc-controls cc-animate-color', 'cc-hover-text cc-controls cc-animate-color',
'font-math', 'font-math',
className className
)} )}

View File

@ -20,9 +20,9 @@ export function RSTokenButton({ token, disabled, onInsert }: RSTokenButtonProps)
onClick={() => onInsert(token)} onClick={() => onInsert(token)}
className={clsx( className={clsx(
'h-5 sm:h-6', 'h-5 sm:h-6',
'px-1', 'px-1 rounded-md',
'outline-hidden', 'outline-hidden',
'cc-hover cc-controls cc-animate-color', 'cc-hover-text cc-controls cc-animate-color',
'font-math', 'font-math',
'cursor-pointer disabled:cursor-default', 'cursor-pointer disabled:cursor-default',
label.length > 3 ? 'w-14.5 md:w-18' : 'w-7.25 md:w-9' label.length > 3 ? 'w-14.5 md:w-18' : 'w-7.25 md:w-9'

View File

@ -20,12 +20,18 @@
background-color: var(--color-selected); background-color: var(--color-selected);
} }
@utility cc-hover { @utility cc-hover-bg {
&:hover:not(:disabled) { &:hover:not(:disabled) {
background-color: var(--color-accent); background-color: var(--color-accent);
} }
} }
@utility cc-hover-text {
&:hover:not(:disabled) {
color: var(--color-foreground);
}
}
@utility focus-outline { @utility focus-outline {
--focus-color: var(--color-ring); --focus-color: var(--color-ring);