Skip to content

Commit

Permalink
refactor the code
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeriaMaltseva committed Oct 1, 2024
1 parent f7d7c85 commit c20f5ce
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 39 deletions.
7 changes: 6 additions & 1 deletion assets/js/src/core/components/tag-list/tag-list.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@

import { createStyles } from 'antd-style'

export const useStyles = createStyles(({ css, token }, props: { itemRowGap?: number, itemColGap?: number }) => {
interface StylesProps {
itemRowGap?: number
itemColGap?: number
}

export const useStyles = createStyles(({ css, token }, props: StylesProps) => {
return {
tagListGroup: css`
row-gap: ${props.itemRowGap ?? token.Tag.rowGapXXS}px;
Expand Down
74 changes: 36 additions & 38 deletions assets/js/src/core/components/workflow-card/workflow-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,48 +60,46 @@ export const WorkflowCard = ({ workflow }: IWorkflowCardProps): React.JSX.Elemen
}

return (
<>
<Card
className={ styles.workflowCard }
extra={ <DropdownButton /> }
title={ (
<>
<p>{workflow.workflowName}</p>
<Card
className={ styles.workflowCard }
extra={ <DropdownButton /> }
title={ (
<>
<p>{workflow.workflowName}</p>

{workflow.workflowStatus !== undefined && workflow.workflowStatus?.length > 0 && (
workflow.workflowStatus.map((status, index) => (
<Tag
className={ status.colorInverted ? 'color-inverted' : '' }
icon={
<Badge
color={ status.color }
styles={ status.colorInverted
? { indicator: { outline: `1px solid ${status.color}4D` } }
: {}
{workflow.workflowStatus !== undefined && workflow.workflowStatus?.length > 0 && (
workflow.workflowStatus.map((status, index) => (
<Tag
className={ status.colorInverted ? 'color-inverted' : '' }
icon={
<Badge
color={ status.color }
styles={ status.colorInverted
? { indicator: { outline: `1px solid ${status.color}4D` } }
: {}
}
/>
/>
}
key={ index }
style={ status.colorInverted
? { backgroundColor: `${status.color}33` }
: {}
key={ index }
style={ status.colorInverted
? { backgroundColor: `${status.color}33` }
: {}
}
title={ status.title }
>
{status.label}
</Tag>
))
)}
</>
title={ status.title }
>
{status.label}
</Tag>
))
)}
</>
) }
>
{workflow.graph !== undefined && (
<img
alt={ 'workflow' }
src={ `data:image/svg+xml;utf8,${encodeURIComponent(workflow.graph)}` }
/>
)}
</Card>
</>
>
{workflow.graph !== undefined && (
<img
alt={ 'workflow' }
src={ `data:image/svg+xml;utf8,${encodeURIComponent(workflow.graph)}` }
/>
)}
</Card>
)
}

0 comments on commit c20f5ce

Please sign in to comment.