Type icon status

pull/5370/head
ioedeveloper 6 months ago
parent 14cdb7711e
commit 7790657dd0
  1. 4
      libs/remix-ui/vertical-icons-panel/src/lib/components/Badge.tsx
  2. 8
      libs/remix-ui/vertical-icons-panel/src/lib/components/Icon.tsx
  3. 6
      libs/remix-ui/vertical-icons-panel/src/lib/reducers/iconBadgeReducer.ts

@ -16,7 +16,7 @@ function Badge({ badgeStatus }: BadgeProps) {
* @param {Object} key * @param {Object} key
* @param {Object} type * @param {Object} type
*/ */
function resolveClasses(key: string, type: string) { function resolveClasses(key: string | number, type: string) {
let classes = 'remixui_status' let classes = 'remixui_status'
switch (key) { switch (key) {
case 'succeed': case 'succeed':
@ -38,7 +38,7 @@ function Badge({ badgeStatus }: BadgeProps) {
return classes return classes
} }
function checkStatusKeyValue(value: any, type: string) { function checkStatusKeyValue(value: any, type: BadgeStatus['type']) {
if ( if (
value === 'succeed' || value === 'succeed' ||
value === 'edited' || value === 'edited' ||

@ -9,14 +9,14 @@ import { IconRecord } from '../types'
import { CustomTooltip } from '@remix-ui/helper' import { CustomTooltip } from '@remix-ui/helper'
export interface IconStatus { export interface IconStatus {
key: string key: string | number
title: string title: string
type: string type: 'danger' | 'error' | 'success' | 'info' | 'warning'
pluginName?: string pluginName?: string
} }
export interface BadgeStatus extends IconStatus { export interface BadgeStatus extends IconStatus {
text: string text: string | number
} }
interface IconProps { interface IconProps {
@ -30,7 +30,7 @@ const initialState = {
text: '', text: '',
key: '', key: '',
title: '', title: '',
type: '', type: null,
pluginName: '' pluginName: ''
} }

@ -15,14 +15,14 @@ export type IconBadgeReducerAction = {
function setIconStatus(name: string, status: IconStatus) { function setIconStatus(name: string, status: IconStatus) {
if (status.key === 'none') return { ...status, text: '' } // remove status if (status.key === 'none') return { ...status, text: '' } // remove status
let text = '' let text: string | number
let key = '' let key: string | number
if (typeof status.key === 'number') { if (typeof status.key === 'number') {
key = status.key key = status.key
text = key text = key
} else key = checkSpecialChars(status.key) ? bleach.sanitize(status.key) : status.key } else key = checkSpecialChars(status.key) ? bleach.sanitize(status.key) : status.key
let thisType = '' let thisType: IconStatus['type']
if (status.type === 'error') { if (status.type === 'error') {
thisType = 'danger' // to use with bootstrap thisType = 'danger' // to use with bootstrap
} else thisType = checkSpecialChars(status.type) ? bleach.sanitize(status.type) : status.type } else thisType = checkSpecialChars(status.type) ? bleach.sanitize(status.type) : status.type

Loading…
Cancel
Save