1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 14:34:19 +00:00

🚧 Add components ConditionBadge.js and ButtonSmallX.js

Documentation is missing
This commit is contained in:
Stefano Pigozzi 2021-04-29 04:27:06 +02:00
parent 61bed76db8
commit 875c5e0da9
Signed by untrusted user who does not match committer: steffo
GPG key ID: 6965406171929D01
4 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,14 @@
import React from "react"
import Style from "./ButtonSmallX.module.css"
import classNames from "classnames"
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"
import { faTimes } from "@fortawesome/free-solid-svg-icons"
export default function ButtonSmallX({ children, className, ...props }) {
return (
<button type={"button"} className={classNames(Style.ButtonSmallX, className)} {...props}>
<FontAwesomeIcon icon={faTimes}/>
</button>
)
}

View file

@ -0,0 +1,23 @@
.ButtonSmallX {
border-width: 0;
border-radius: 9999px;
line-height: 0;
height: 18px;
width: 18px;
vertical-align: baseline;
background-color: var(--bg-field-off);
color: var(--fg-field-off);
cursor: pointer;
position: relative;
top: -1px;
}
.ButtonSmallX:focus {
outline: none;
background-color: var(--bg-field-on);
color: var(--fg-field-on);
}
.ButtonSmallX:focus-visible {
outline: 2px dashed var(--outline);
}

View file

@ -0,0 +1,22 @@
import React from "react"
import Style from "./ConditionBadge.module.css"
import classNames from "classnames"
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"
import ButtonSmallX from "./ButtonSmallX"
export default function ConditionBadge({ color, icon, onDelete, children, className, ...props }) {
return (
<div className={classNames(Style.ConditionBadge, Style[`ConditionBadge${color}`], className)} {...props}>
<div className={Style.Icon}>
<FontAwesomeIcon icon={icon}/>
</div>
<div>
{children}
</div>
<div>
<ButtonSmallX onClick={onDelete}/>
</div>
</div>
)
}

View file

@ -0,0 +1,33 @@
.ConditionBadge {
display: inline-flex;
gap: 5px;
padding: 0 5px;
border-radius: 25px;
margin: 0 2px;
}
.ConditionBadgeRed {
background-color: var(--bg-red);
color: var(--fg-red)
}
.ConditionBadgeYellow {
background-color: var(--bg-yellow);
color: var(--fg-yellow)
}
.ConditionBadgeGrey {
background-color: var(--bg-grey);
color: var(--fg-grey)
}
.ConditionBadgeGreen {
background-color: var(--bg-green);
color: var(--fg-green)
}
.Icon {
width: 15px;
text-align: center;
}