From 3cf70771cb45cc16ec33ffe44e7a1a4799d8f395 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 23 Jun 2020 23:18:07 +0200 Subject: adding web app base --- .../frontend/common/miscellaneous.component.js | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 animism-align/frontend/common/miscellaneous.component.js (limited to 'animism-align/frontend/common/miscellaneous.component.js') diff --git a/animism-align/frontend/common/miscellaneous.component.js b/animism-align/frontend/common/miscellaneous.component.js new file mode 100644 index 0000000..4eb23f1 --- /dev/null +++ b/animism-align/frontend/common/miscellaneous.component.js @@ -0,0 +1,82 @@ +import React, { Component } from 'react'; +import { Link } from 'react-router-dom' +import { clamp, percent } from '../util' + +export const Loader = () => ( +
+
+
+
+
+
+
+
+) + +export const Swatch = ({ color }) => ( +
+) + +export const Dot = ({ color }) => ( +
+) + +export const Columns = ({ count, margin, width, object, children, className }) => { + if (!object || !object.length) object = children + if (!object || !object.length) return null + margin = margin || 380 + width = width || 250 + count = count || Math.floor((window.innerWidth - margin) / width) + let columns = [] + let len = object.length + let j = 0 + for (let i = 0; i < count; i++) { + let column_len = len * (i + 1) / count + let column = [] + for (; j < column_len; j++) { + column.push(
{object[j]}
) + } + columns.push(
{column}
) + if (j >= len) break + } + return ( +
+ {columns} +
+ ) +} + +export const Statistic = ({ name, value, link }) => ( +
+
{link ? {name} : name}
+
{value}
+
+) + +export const Detections = ({ detections, labels }) => ( + (detections || []).map(({ label, rect }, i) => ( +
+ {labels && {label.replace(/_/g, ' ')}} +
+ ) +)) + +export const Progress = ({ current, total }) => ( +
+
+
+) -- cgit v1.2.3-70-g09d2