mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
properly handle overflow on sidebar items (#971)
This commit is contained in:
parent
88be98f703
commit
8eb591bd08
5 changed files with 39 additions and 6 deletions
|
|
@ -10,7 +10,7 @@
|
||||||
"selector-type-no-unknown": [true, { "ignoreTypes": ["/-styled-mixin/", "/^\\$\\w+/"] }],
|
"selector-type-no-unknown": [true, { "ignoreTypes": ["/-styled-mixin/", "/^\\$\\w+/"] }],
|
||||||
"declaration-block-no-shorthand-property-overrides": null,
|
"declaration-block-no-shorthand-property-overrides": null,
|
||||||
"declaration-block-no-redundant-longhand-properties": null,
|
"declaration-block-no-redundant-longhand-properties": null,
|
||||||
"at-rule-no-unknown": [true, { "ignoreAtRules": ["mixin"] }],
|
"at-rule-no-unknown": [true, { "ignoreAtRules": ["mixin", "value"] }],
|
||||||
"function-no-unknown": [true, { "ignoreFunctions": ["darken", "alpha", "lighten"] }],
|
"function-no-unknown": [true, { "ignoreFunctions": ["darken", "alpha", "lighten"] }],
|
||||||
"declaration-property-value-no-unknown": null,
|
"declaration-property-value-no-unknown": null,
|
||||||
"no-descending-specificity": null,
|
"no-descending-specificity": null,
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inner {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
display: block;
|
||||||
|
align-content: center;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,20 @@ interface SidebarItemProps extends ButtonProps {
|
||||||
to: LinkProps['to'];
|
to: LinkProps['to'];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SidebarItem = ({ children, to, ...props }: SidebarItemProps) => {
|
export const SidebarItem = ({ children, className, to, ...props }: SidebarItemProps) => {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
className={clsx({
|
className={clsx(
|
||||||
|
{
|
||||||
[styles.disabled]: props.disabled,
|
[styles.disabled]: props.disabled,
|
||||||
[styles.link]: true,
|
[styles.link]: true,
|
||||||
})}
|
},
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
classNames={{
|
||||||
|
inner: styles.inner,
|
||||||
|
label: styles.label,
|
||||||
|
}}
|
||||||
component={Link}
|
component={Link}
|
||||||
to={to}
|
to={to}
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
@value label from './sidebar-item.module.css';
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
padding: var(--theme-spacing-sm) var(--theme-spacing-md);
|
padding: var(--theme-spacing-sm) var(--theme-spacing-md);
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +10,12 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.row-hover {
|
||||||
|
:global(.label) {
|
||||||
|
margin-right: 135px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { closeAllModals, openModal } from '@mantine/modals';
|
import { closeAllModals, openModal } from '@mantine/modals';
|
||||||
|
import clsx from 'clsx';
|
||||||
import { MouseEvent, useCallback, useMemo, useState } from 'react';
|
import { MouseEvent, useCallback, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { generatePath } from 'react-router';
|
import { generatePath } from 'react-router';
|
||||||
|
|
@ -43,6 +44,9 @@ const PlaylistRowButton = ({ name, onPlay, to, ...props }: PlaylistRowButtonProp
|
||||||
onMouseLeave={() => setIsHovered(false)}
|
onMouseLeave={() => setIsHovered(false)}
|
||||||
>
|
>
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
|
className={clsx({
|
||||||
|
[styles.rowHover]: isHovered,
|
||||||
|
})}
|
||||||
to={url}
|
to={url}
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue