forked from akuity/kargo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Clicking multiple times on same freight not working (akuity#2846)
Signed-off-by: Dusan Plavak <dusan.plavak@gmail.com>
- Loading branch information
Showing
2 changed files
with
65 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { IconDefinition } from '@fortawesome/free-solid-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { Tooltip } from 'antd'; | ||
import classNames from 'classnames'; | ||
|
||
import { TruncateMiddle } from '../common/truncate-middle'; | ||
|
||
export const FreightContentItem = (props: { | ||
icon: IconDefinition; | ||
overlay?: React.ReactNode; | ||
title?: string; | ||
href?: string; | ||
children?: string; | ||
horizontal?: boolean; | ||
dark?: boolean; | ||
highlighted: boolean; | ||
linkClass: string; | ||
}) => { | ||
const { horizontal, dark, highlighted, overlay, title, icon, href, children, linkClass } = props; | ||
return ( | ||
<Tooltip | ||
className={classNames('min-w-0 flex items-center justify-center my-1 rounded', { | ||
'flex-col p-1 w-full': !horizontal, | ||
'mr-2 p-2 max-w-60 flex-shrink': horizontal, | ||
'bg-black text-white': dark, | ||
'bg-white': !dark && highlighted && !horizontal, | ||
'border border-solid border-gray-200': !dark && !highlighted && !horizontal, | ||
'bg-gray-200': !dark && horizontal | ||
})} | ||
overlay={overlay} | ||
title={title} | ||
> | ||
<FontAwesomeIcon | ||
icon={icon} | ||
style={{ fontSize: '14px' }} | ||
className={classNames('px-1', { | ||
'mb-2': !horizontal, | ||
'mr-2': horizontal | ||
})} | ||
/> | ||
{href ? ( | ||
<a target='_blank' className={linkClass}> | ||
<TruncateMiddle>{children || ''}</TruncateMiddle> | ||
</a> | ||
) : ( | ||
<TruncateMiddle>{children || ''}</TruncateMiddle> | ||
)} | ||
</Tooltip> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters