-
Notifications
You must be signed in to change notification settings - Fork 880
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove all dependencies on argo-ui/v2
Signed-off-by: Remington Breeze <[email protected]>
- Loading branch information
Showing
12 changed files
with
353 additions
and
256 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
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
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
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,80 @@ | ||
@import 'node_modules/argo-ui/v2/styles/colors'; | ||
|
||
.info-item { | ||
background-color: $argo-color-gray-4; | ||
border-radius: 3px; | ||
border: 1px solid $argo-color-gray-5; | ||
padding: 5px 7px; | ||
margin-right: 5px; | ||
color: $argo-color-gray-8; | ||
display: flex; | ||
align-items: center; | ||
min-width: 0; | ||
|
||
&--lightweight { | ||
border: none; | ||
background: none; | ||
font-weight: 500; | ||
padding-left: 0; | ||
padding-right: 0; | ||
} | ||
|
||
&--dark { | ||
background-color: $fog; | ||
border: 1px solid $silver-lining; | ||
color: $dull-shine; | ||
} | ||
|
||
&--colored { | ||
background-color: $sherbert; | ||
border: 1px solid $sherbert; | ||
color: white; | ||
} | ||
|
||
&--dark#{&}--colored { | ||
background-color: $spray-tan; | ||
border: 1px solid $sherbert; | ||
color: white; | ||
} | ||
|
||
&--canary { | ||
background-color: $canary; | ||
border: 1px solid $canary; | ||
color: $space; | ||
} | ||
|
||
&--bluegreen { | ||
background-color: $sea; | ||
border: 1px solid $sea; | ||
color: white; | ||
} | ||
|
||
&--monospace { | ||
font-family: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono', | ||
'Droid Sans Mono', 'Courier New', monospace; | ||
font-size: 14px; | ||
} | ||
|
||
&--row { | ||
display: flex; | ||
align-items: center; | ||
flex-grow: 1; | ||
label { | ||
margin-right: auto; | ||
padding-right: 5px; | ||
} | ||
.info-item { | ||
margin: 0.25em 0; | ||
margin-left: 5px; | ||
} | ||
|
||
&__container { | ||
margin-left: auto; | ||
display: flex; | ||
min-width: 0; | ||
padding-left: 25px; | ||
flex-wrap: wrap; | ||
justify-content: flex-end; | ||
} | ||
} | ||
} |
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,61 @@ | ||
import * as React from 'react'; | ||
import './info-item.scss'; | ||
import { Tooltip } from 'antd'; | ||
|
||
export enum InfoItemKind { | ||
Default = 'default', | ||
Colored = 'colored', | ||
Monospace = 'monospace', | ||
Canary = 'canary', | ||
BlueGreen = 'bluegreen', | ||
} | ||
|
||
export interface InfoItemProps { | ||
content?: string; | ||
icon?: string; | ||
style?: React.CSSProperties; | ||
kind?: InfoItemKind; | ||
truncate?: boolean; | ||
lightweight?: boolean; | ||
} | ||
|
||
/** | ||
* Displays a small piece encapsulated piece of data | ||
*/ | ||
export const InfoItem = (props: InfoItemProps) => { | ||
const truncateStyle = props.truncate ? {overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis'} : {}; | ||
const item = ( | ||
<div className={`info-item${props.kind ? ` info-item--${props.kind}` : ''} ${props.lightweight ? 'info-item--lightweight' : ''}`} style={props.style}> | ||
{props.icon && ( | ||
<span style={props.content && {marginRight: '5px'}}> | ||
<i className={`fa ${props.icon}`} /> | ||
</span> | ||
)} | ||
<div style={truncateStyle as React.CSSProperties}>{props.content}</div> | ||
</div> | ||
); | ||
return props.truncate ? <Tooltip title={props.content}>{item}</Tooltip> : item; | ||
}; | ||
|
||
/** | ||
* Displays a right justified InfoItem (or multiple InfoItems) and a left justfied label | ||
*/ | ||
export const InfoItemRow = (props: {label: string | React.ReactNode; items?: InfoItemProps | InfoItemProps[]; lightweight?: boolean}) => { | ||
let {label, items} = props; | ||
let itemComponents = null; | ||
if (!Array.isArray(items)) { | ||
items = [items]; | ||
} | ||
itemComponents = items.map((c, i) => <InfoItem key={`${c} ${i}`} {...c} lightweight={c.lightweight === undefined ? props.lightweight : c.lightweight} />); | ||
|
||
return ( | ||
<div className='info-item--row'> | ||
{props.label && ( | ||
<div> | ||
<label>{label}</label> | ||
</div> | ||
)} | ||
{props.items && <div className='info-item--row__container'>{itemComponents}</div>} | ||
</div> | ||
); | ||
}; |
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
Oops, something went wrong.