From f09ea01f9e8ad1c615657084b697188d609c1bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Sun, 31 Aug 2025 19:19:57 +0200 Subject: [PATCH] pl-fe: start migratin goff tailwind i guess? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/pl-fe/src/components/list.tsx | 55 ++++------------- packages/pl-fe/src/components/ui/icon.tsx | 2 +- packages/pl-fe/src/components/ui/select.tsx | 2 +- packages/pl-fe/src/styles/application.scss | 2 + packages/pl-fe/src/styles/new/index.scss | 1 + packages/pl-fe/src/styles/new/ui.scss | 68 +++++++++++++++++++++ 6 files changed, 86 insertions(+), 44 deletions(-) create mode 100644 packages/pl-fe/src/styles/new/index.scss create mode 100644 packages/pl-fe/src/styles/new/ui.scss diff --git a/packages/pl-fe/src/components/list.tsx b/packages/pl-fe/src/components/list.tsx index 95904a6c5..4c5a1b908 100644 --- a/packages/pl-fe/src/components/list.tsx +++ b/packages/pl-fe/src/components/list.tsx @@ -12,7 +12,7 @@ interface IList { } const List: React.FC = ({ children }) => ( -
{children}
+
{children}
); interface IListItem { @@ -22,13 +22,12 @@ interface IListItem { to?: string; href?: string; onClick?(): void; - onSelect?(): void; isSelected?: boolean; children?: React.ReactNode; size?: 'sm' | 'md'; } -const ListItem: React.FC = ({ className, label, hint, children, to, href, onClick, onSelect, isSelected, size = 'md' }) => { +const ListItem: React.FC = ({ className, label, hint, children, to, href, onClick, isSelected, size = 'md' }) => { const [domId] = useState(`list-group-${crypto.randomUUID()}`); const onKeyDown = (e: React.KeyboardEvent) => { @@ -37,7 +36,7 @@ const ListItem: React.FC = ({ className, label, hint, children, to, h } }; - const LabelComp = to || href || onClick || onSelect ? 'span' : 'label'; + const LabelComp = to || href || onClick ? 'span' : 'label'; const renderChildren = React.useCallback(() => React.Children.map(children, (child) => { if (React.isValidElement(child)) { @@ -55,61 +54,33 @@ const ListItem: React.FC = ({ className, label, hint, children, to, h return null; }), [children, domId]); - const classNames = clsx('flex items-center justify-between overflow-hidden bg-gradient-to-r from-gradient-start/10 to-gradient-end/10 first:rounded-t-lg last:rounded-b-lg dark:from-gradient-start/10 dark:to-gradient-end/10', + const classNames = clsx('⁂-list-item', className, { - 'px-4 py-2': size === 'md', - 'px-2 py-0.5': size === 'sm', - 'cursor-pointer hover:from-gradient-start/20 hover:to-gradient-end/20 dark:hover:from-gradient-start/5 dark:hover:to-gradient-end/5': typeof to !== 'undefined' || typeof onClick !== 'undefined' || typeof onSelect !== 'undefined', + '⁂-list-item--md': size === 'md', + '⁂-list-item--sm': size === 'sm', }, ); const body = ( <> -
- {label} +
+ {label} {hint ? ( - {hint} + {hint} ) : null}
{(to || href || onClick) ? ( - + {children} - + ) : null} - {onSelect ? ( -
- {children} - -
- -
-
- ) : null} - - {typeof to === 'undefined' && typeof onClick === 'undefined' && typeof onSelect === 'undefined' ? renderChildren() : null} + {typeof to === 'undefined' && typeof onClick === 'undefined' ? renderChildren() : null} ); @@ -120,7 +91,7 @@ const ListItem: React.FC = ({ className, label, hint, children, to, h ); const Comp = onClick || href ? 'a' : 'div'; - const linkProps = onClick || onSelect || href ? { onClick: onClick || onSelect, onKeyDown, tabIndex: 0, role: 'link', ...(href && { href, target: '_blank' }) } : {}; + const linkProps = onClick || href ? { onClick, onKeyDown, tabIndex: 0, role: 'link', ...(href && { href, target: '_blank' }) } : {}; return ( , 'strokeWidth'> { /** Renders and SVG icon with optional counter. */ const Icon: React.FC = React.forwardRef(({ src, alt, count, size, countMax, containerClassName, title, ...filteredProps }, ref): JSX.Element => (
((props, ref) => {