fix badge for tab title

pull/3838/head
Joseph Izang 1 year ago
parent 5f9e20486f
commit 64bb7aa0da
  1. 10
      libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx

@ -1,4 +1,4 @@
import React from 'react' import React, { useEffect } from 'react'
import { ErrorRendererOptions } from '../../staticanalyser' import { ErrorRendererOptions } from '../../staticanalyser'
type BasicTitleProps = { type BasicTitleProps = {
@ -31,14 +31,18 @@ export function calculateWarningStateEntries(entries: [string, any][]) {
} }
export function BasicTitle(props: BasicTitleProps) { export function BasicTitle(props: BasicTitleProps) {
const[warningCount, setWarningCount] = React.useState(props.warningStateEntries.length)
useEffect(() => {
}, [props.warningStateEntries.length])
return ( return (
<span>Remix{props.warningStateEntries.length > 0 ? !props.hideWarnings ? props.showLibsWarnings ? <i data-id="StaticAnalysisErrorCount" className={`badge ${calculateWarningStateEntries(props.warningStateEntries).length > 0 ? 'badge-warning' : 'badge-danger'} rounded-circle ml-1 text-center`}> <span>Remix{props.warningStateEntries.length > 0 ? !props.hideWarnings ? !props.showLibsWarnings ? <i data-id="StaticAnalysisErrorCount" className={`badge ${calculateWarningStateEntries(props.warningStateEntries).length > 0 ? 'badge-warning' : 'badge-danger'} rounded-circle ml-1 text-center`}>
{ {
calculateWarningStateEntries(props.warningStateEntries).length}</i>: ( calculateWarningStateEntries(props.warningStateEntries).length}</i>: (
<i className="badge badge-warning rounded-circle ml-1 text-center"> <i className="badge badge-warning rounded-circle ml-1 text-center">
{ {
calculateWarningStateEntries(props.warningStateEntries).length warningCount
} }
</i> </i>
) : null : null} ) : null : null}

Loading…
Cancel
Save