import React from "react"
import { Box, Center } from "@chakra-ui/react"
import { GradientPath } from "gradient-path"
export const Rainbow = (props: any): JSX.Element => {
const rainbow = ["#f34a4a", "#ffbc48", "#58ca70", "#47b5e6", "#a555e8"]
const [colors, setColors] = React.useState(props?.colors || rainbow)
const repeatedColours = React.useMemo(() => {
return [...colors, colors[0]]
}, [colors])
// make SVG that takes makes path in the shape of a box
// which adjusts to the parent containers size
const [strokeWidth, setStrokeWidth] = React.useState(1)
const [extraStroke, setExtraStroke] = React.useState(0)
const [width, setWidth] = React.useState(props?.width || "105%")
const [height, setHeight] = React.useState(props?.height || "105%")
const pathString = React.useMemo(() => {
const startPoint = 0 + strokeWidth / 2
const endPoint = 100 - strokeWidth / 2
return `M -${4} ${startPoint} H ${endPoint} V ${endPoint} H ${startPoint} V ${startPoint}`
}, [strokeWidth])
const viewBox = React.useMemo(() => {
return `0 0 100 100`
}, [])
const svgRef = React.useRef(null)
const svg = React.useMemo(() => {
return (