{title}
+{content}
+Claim your MIR tokens
+ +{content}
+{children}
+{children}
+{error}
} +{stringify(children)}+) + +export default Pre + +/* helpers */ +const stringify = (param: any) => { + try { + return JSON.stringify(param, null, 2) + } catch (error) { + return param + } +} diff --git a/src/components/PreLine.module.scss b/src/components/PreLine.module.scss new file mode 100644 index 000000000..b37833bf2 --- /dev/null +++ b/src/components/PreLine.module.scss @@ -0,0 +1,3 @@ +.component { + white-space: pre-line; +} diff --git a/src/components/PreLine.tsx b/src/components/PreLine.tsx new file mode 100644 index 000000000..74add40af --- /dev/null +++ b/src/components/PreLine.tsx @@ -0,0 +1,11 @@ +import { FC, HTMLAttributes } from "react" +import styles from "./PreLine.module.scss" + +type Props = HTMLAttributes
+ {children} +
+) + +export default PreLine diff --git a/src/components/Progress.module.scss b/src/components/Progress.module.scss new file mode 100644 index 000000000..e0a245059 --- /dev/null +++ b/src/components/Progress.module.scss @@ -0,0 +1,90 @@ +@import "mixins"; +@import "variables"; + +.component { + user-select: none; +} + +.cursor { + cursor: crosshair; +} + +/* axis */ +$axis-height: 25px; +.axis { + position: relative; + height: $axis-height; +} + +.x { + position: absolute; + top: 0; + color: $slate; + font-size: 12px; + font-weight: 500; + height: $axis-height; + transform: translate(-50%, 0); + + &:after { + content: ""; + display: block; + width: 1px; + height: 5px; + background: $slate; + + position: absolute; + left: 50%; + bottom: 0; + } +} + +/* track */ +.track { + @include flex(flex-start, stretch); + background: $slate; + border-radius: 4px; + height: 8px; + overflow: hidden; +} + +.item { + @include transition; +} + +/* feedback */ +.feedback { + margin-top: 5px; +} + +.label { + font-size: 12px; + font-weight: 600; + text-transform: uppercase; +} + +/* feedback:ratio */ +.ratio { + @include transition; + transform: translate(-50%, 0); +} + +/* feedback:vote */ +.vote { + @include flex(space-between); +} + +.text { + text-align: center; + + &:first-child { + text-align: left; + } + + &:last-child { + text-align: right; + } +} + +.percent { + font-size: 16px; +} diff --git a/src/components/Progress.tsx b/src/components/Progress.tsx new file mode 100644 index 000000000..7ec8b83a5 --- /dev/null +++ b/src/components/Progress.tsx @@ -0,0 +1,75 @@ +import { MouseEvent, ReactNode, useRef } from "react" +import classNames from "classnames/bind" +import { div } from "../libs/math" +import { percent } from "../libs/num" +import styles from "./Progress.module.scss" + +const cx = classNames.bind(styles) + +interface Item { + value: string + label?: string + color?: "blue" | "orange" | "red" +} + +interface Props { + data: Item[] + axis?: { x: string; label: ReactNode }[] + className?: string + onClick?: (x: string) => void + noLabel?: boolean +} + +const Progress = ({ data, axis, className, onClick, noLabel }: Props) => { + const componentRef = useRef+ {render?.(value, record, index) ?? value} + | + ) + } + + return ( +
{children}
+ ) : ( + children + )} +{title} | +{content} | +
---|
{introduction}
+ +{content}
+{conclusion}
+ + + + +