Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add class name to reqore tag actions #374

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qoretechnologies/reqore",
"version": "0.40.9",
"version": "0.40.10",
"description": "ReQore is a highly theme-able and modular UI library for React",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
25 changes: 15 additions & 10 deletions src/components/Tag/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _size from 'lodash/size';
import { rgba } from 'polished';
import React, { forwardRef, useState } from 'react';
import React, { forwardRef, HTMLAttributes, useState } from 'react';
import styled, { css } from 'styled-components';
import { ReqorePopover, useReqoreTheme } from '../..';
import {
Expand Down Expand Up @@ -41,7 +41,11 @@ import {
} from '../Effect';
import ReqoreIcon, { IReqoreIconProps } from '../Icon';

export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
export interface IReqoreTagAction
extends IWithReqoreTooltip,
IReqoreDisabled,
IReqoreIntent,
HTMLAttributes<HTMLSpanElement> {
icon: IReqoreIconName;
show?: boolean;
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
Expand Down Expand Up @@ -410,25 +414,26 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
{_size(actions)
? actions
.filter((action) => action.show !== false)
.map((action, index) => (
.map(({ intent, onClick, icon, tooltip, ...action }, index) => (
<React.Fragment key={index}>
<ReqorePopover
component={StyledButtonWrapper}
componentProps={{
size,
color: getCustomColor(action.intent),
color: getCustomColor(intent),
className: 'reqore-tag-action',
onClick: action.onClick,
onClick: onClick,
effect: rest.effect,
...action,
}}
{...(action.tooltip
? typeof action.tooltip === 'string'
? { tooltip: action.tooltip }
: action.tooltip
{...(tooltip
? typeof tooltip === 'string'
? { tooltip: tooltip }
: tooltip
: {})}
isReqoreComponent
>
<ReqoreIcon icon={action.icon} size={size} />
<ReqoreIcon icon={icon} size={size} />
</ReqorePopover>
</React.Fragment>
))
Expand Down
Loading