diff --git a/Parts/Button.js b/Parts/Button.js index e56a919..00a10b1 100644 --- a/Parts/Button.js +++ b/Parts/Button.js @@ -1,13 +1,13 @@ -import React from 'react' +import React from "react" import tw, {styled} from "twin.macro" -import 'styled-components/macro' -import { colors, colorsDisabled, colorsHover } from './Colors' +import "styled-components/macro" +import { colors, colorsDisabled, colorsHover } from "./Colors" const BtnBase = styled.button(({ type }) => [ - tw`bg-secondary hover:bg-trinary disabled:bg-trinary m-2 outline-none focus:outline-none text-primary font-bold ease-linear transition-all duration-150`, - colors[type], colorsHover[type], colorsDisabled[type] + tw`bg-secondary hover:bg-trinary disabled:bg-trinary m-2 outline-none focus:outline-none text-primary font-bold ease-linear transition-all duration-150`, + colors[type], colorsHover[type], colorsDisabled[type] ]) /* diff --git a/Parts/Card.js b/Parts/Card.js index 4253e72..62bc23f 100644 --- a/Parts/Card.js +++ b/Parts/Card.js @@ -1,19 +1,18 @@ import React from "react"; import tw, {styled} from "twin.macro" -import 'styled-components/macro' +import "styled-components/macro" + +let Card = styled.div(tw`relative flex flex-col min-w-0 break-words bg-primary w-full shadow-xl rounded-2xl`) + +export default Card; -export default function Card(props) { - return
- {props.children} -
; -} export function CardHeader(props) { - return
-
-
- { props.desc != null ?

{props.desc}

: ""} -
- {props.children} + return
+
+
+ { props.desc != null ?

{props.desc}

: ""}
-
; - } \ No newline at end of file + {props.children} +
+
; +} \ No newline at end of file diff --git a/Parts/Charts.js b/Parts/Charts.js index ac3d2fb..f801d63 100644 --- a/Parts/Charts.js +++ b/Parts/Charts.js @@ -1,5 +1,5 @@ import React, { useRef, useState } from "react"; -import Chart from 'chart.js/auto'; +import Chart from "chart.js/auto"; import Card, { CardHeader } from "./Card"; import { createPopper } from "@popperjs/core"; @@ -25,16 +25,16 @@ function generateGetBoundingClientRect(x = 0, y = 0) { return () => ({ width: 0, function GetPlacement(tooltipModel) { switch (tooltipModel.xAlign) { - case "right": - return "left"; - case "left": - return "right"; + case "right": + return "left"; + case "left": + return "right"; } switch (tooltipModel.yAlign) { - case "top": - return "bottom"; - case "bottom": - return "top"; + case "top": + return "bottom"; + case "bottom": + return "top"; } } diff --git a/Parts/Colors.js b/Parts/Colors.js index 707f367..8a35638 100644 --- a/Parts/Colors.js +++ b/Parts/Colors.js @@ -1,47 +1,47 @@ import tw, {styled} from "twin.macro" -import 'styled-components/macro' +import "styled-components/macro" export let colors = { - error: tw`bg-red-600`, - accent: tw`bg-accent`, - accent2: tw`bg-accent2`, - accent3: tw`bg-accent3`, - accent4: tw`bg-accent4`, - accent5: tw`bg-accent5`, + error: tw`bg-red-600`, + accent: tw`bg-accent`, + accent2: tw`bg-accent2`, + accent3: tw`bg-accent3`, + accent4: tw`bg-accent4`, + accent5: tw`bg-accent5`, } export let colorsHover = { - error: tw`hover:bg-red-700`, - accent: tw`hover:bg-accent-dark`, - accent2: tw`hover:bg-accent2-dark`, - accent3: tw`hover:bg-accent3-dark`, - accent4: tw`hover:bg-accent4-dark`, - accent5: tw`hover:bg-accent5-dark`, + error: tw`hover:bg-red-700`, + accent: tw`hover:bg-accent-dark`, + accent2: tw`hover:bg-accent2-dark`, + accent3: tw`hover:bg-accent3-dark`, + accent4: tw`hover:bg-accent4-dark`, + accent5: tw`hover:bg-accent5-dark`, } export let colorsDisabled = { - error: tw`disabled:bg-red-700`, - accent: tw`disabled:bg-accent-dark`, - accent2: tw`disabled:bg-accent2-dark`, - accent3: tw`disabled:bg-accent3-dark`, - accent4: tw`disabled:bg-accent4-dark`, - accent5: tw`disabled:bg-accent5-dark`, + error: tw`disabled:bg-red-700`, + accent: tw`disabled:bg-accent-dark`, + accent2: tw`disabled:bg-accent2-dark`, + accent3: tw`disabled:bg-accent3-dark`, + accent4: tw`disabled:bg-accent4-dark`, + accent5: tw`disabled:bg-accent5-dark`, } export let textColors = { - error: tw`text-red-600`, - accent: tw`text-accent`, - accent2: tw`text-accent2`, - accent3: tw`text-accent3`, - accent4: tw`text-accent4`, - accent5: tw`text-accent5`, + error: tw`text-red-600`, + accent: tw`text-accent`, + accent2: tw`text-accent2`, + accent3: tw`text-accent3`, + accent4: tw`text-accent4`, + accent5: tw`text-accent5`, } export let textColorsHover = { - error: tw`hover:text-red-700`, - accent: tw`hover:text-accent-dark`, - accent2: tw`hover:text-accent2-dark`, - accent3: tw`hover:text-accent3-dark`, - accent4: tw`hover:text-accent4-dark`, - accent5: tw`hover:text-accent5-dark`, + error: tw`hover:text-red-700`, + accent: tw`hover:text-accent-dark`, + accent2: tw`hover:text-accent2-dark`, + accent3: tw`hover:text-accent3-dark`, + accent4: tw`hover:text-accent4-dark`, + accent5: tw`hover:text-accent5-dark`, } \ No newline at end of file diff --git a/Parts/DropDown.js b/Parts/DropDown.js index 5f7de52..a18187e 100644 --- a/Parts/DropDown.js +++ b/Parts/DropDown.js @@ -2,7 +2,7 @@ import React, { cloneElement, isValidElement, useEffect, useImperativeHandle, us import { createPopper } from "@popperjs/core"; import tw, { styled } from "twin.macro" -import 'styled-components/macro' +import "styled-components/macro" import { colors, colorsDisabled, colorsHover, textColors, textColorsHover } from "./Colors"; const DropDownItem = styled.button(({ type }) => [ @@ -14,7 +14,7 @@ const DropDownItem = styled.button(({ type }) => [ ]) export { DropDownItem } -let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button, popper, placement, hover, ...props }, ref) => { +let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button, buttonProps, popper, placement, hover, ...props }, ref) => { // dropdown props const [overButton, setOverButton] = React.useState(false); const [overDropDown, setOverDropDown] = React.useState(false); @@ -45,17 +45,16 @@ let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button } } - useEffect(() => { - if ('ontouchend' in window) { - document.addEventListener('touchend', handleOutsideClick) + if ("ontouchend" in window) { + document.addEventListener("touchend", handleOutsideClick) } else { - document.addEventListener('click', handleOutsideClick) + document.addEventListener("click", handleOutsideClick) } // Specify how to clean up after this effect: return function cleanup() { - document.removeEventListener('touchend', handleOutsideClick) - document.removeEventListener('click', handleOutsideClick) + document.removeEventListener("touchend", handleOutsideClick) + document.removeEventListener("click", handleOutsideClick) }; }); @@ -82,6 +81,7 @@ let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button }} onMouseEnter={() => { setOverButton(true); hover && openDropdownPopover() }} onMouseLeave={() => { setOverButton(false); (!overDropDown && hover) && closeDropdownPopover() }} + {...buttonProps} > {button} diff --git a/Parts/Input.js b/Parts/Input.js index 2d71eb0..3c706f8 100644 --- a/Parts/Input.js +++ b/Parts/Input.js @@ -1,46 +1,47 @@ -import React from 'react' -import tw from 'twin.macro' -import 'styled-components/macro' +import React from "react" -export default function Input({ label, title, name, id, children, ...props }) { - return ( -
- {title && ( - - )} - - {children} -
- ) +import tw, { styled } from "twin.macro" +import "styled-components/macro" + +export default function Input({ label, title, className, name, id, children, ...props }) { + return ( +
+ {title && ( + + )} + + {children} +
+ ) } -export function TextArea({ label, title, name, id, children, ...props }) { - return ( -
- {title && ( - - )} -