Skip to content

Commit

Permalink
hacky workaround for spinning
Browse files Browse the repository at this point in the history
  • Loading branch information
SchramlTim committed Jun 12, 2024
1 parent eb18d13 commit c7f5e09
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
32 changes: 15 additions & 17 deletions src/components/statusicon/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const statusMapping = {

const StatusIcon = (props) => {

console.log(statusMapping[props.status])

const coloredSteps = new Array(statusMapping[props.status]?.count || 0).fill(null).map(() => {
return <li className={`w-1/6 h-1 rounded ${statusMapping[props.status]?.color}`}></li>
})
Expand All @@ -32,21 +30,21 @@ const StatusIcon = (props) => {
return <li className={`w-1/6 h-1 rounded bg-gray-500`}></li>
})

return (
<i className={`flex flex-col gap-1 w-full items-center text-xs ${props.className || ''}`}>
<StackIcon name={props.name} className="aspect-square" />
<span>{props.name}</span>
{props.status &&
<>
<ol className="flex flex-row justify-between w-2/3">
{coloredSteps}
{graySteps}
</ol>
<span className="text-center text-[0.5rem] leading-3">{props.status}</span>
</>
}
</i>
)
return (
<i className={`flex flex-col gap-1 w-full items-center text-xs ${props.className || ''}`}>
<StackIcon name={props.name} className="aspect-square" />
<span>{props.name}</span>
{props.status &&
<>
<ol className="flex flex-row justify-between w-2/3">
{coloredSteps}
{graySteps}
</ol>
<span className="text-center text-[0.5rem] leading-3">{props.status}</span>
</>
}
</i>
)
}

export {
Expand Down
13 changes: 10 additions & 3 deletions src/solutions/avatar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function easeOutCirc(x) {
const Avatar = () => {
const refContainer = useRef(null);
const refRenderer = useRef()
const refFrame = useRef(0)
let frame = 0

const handleWindowResize = useCallback(() => {
const { current: renderer } = refRenderer
Expand Down Expand Up @@ -93,7 +95,6 @@ const Avatar = () => {
}
)
let req = null
let frame = 0
const animate = () => {
req = requestAnimationFrame(animate)

Expand Down Expand Up @@ -129,10 +130,16 @@ const Avatar = () => {
}
}, [handleWindowResize])

//return (<div></div>)

const trigger = () => {
frame = 0
}

return (
<div className={'w-full'} ref={refContainer}></div>
<div className='w-full h-full relative'>
<div className="absolute inset-0" onClick={() => trigger()}>Bla</div>
<div className={'w-full'} ref={refContainer}></div>
</div>
);
}

Expand Down

0 comments on commit c7f5e09

Please sign in to comment.