-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from Lodestone-Team/newLoadingCard
- Loading branch information
Showing
6 changed files
with
91 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { CircularProgressbar, buildStyles } from 'react-circular-progressbar'; | ||
import 'react-circular-progressbar/dist/styles.css'; | ||
|
||
export default function CircularProgress({ | ||
progress_percent = 0, | ||
}: { | ||
progress_percent?: number; | ||
}) { | ||
return ( | ||
<CircularProgressbar | ||
value={progress_percent * 100} | ||
styles={buildStyles({ | ||
pathColor: '#59B2F3', | ||
trailColor: 'rgba(209, 209, 218, 0.1)', | ||
})} | ||
strokeWidth={15} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
import InstanceLoadingPill from './InstanceLoadingPill'; | ||
|
||
export default { | ||
title: 'library/InstanceLoadingPill', | ||
component: InstanceLoadingPill, | ||
} as ComponentMeta<typeof InstanceLoadingPill>; | ||
|
||
const Template: ComponentStory<typeof InstanceLoadingPill> = (args) => ( | ||
<div className="flex w-60 flex-col child:w-full"> | ||
<InstanceLoadingPill {...args} /> | ||
</div> | ||
); | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
progress_percent: 0.5, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import clsx from 'clsx'; | ||
import { faCircle } from '@fortawesome/free-solid-svg-icons'; | ||
import { stateToColor } from 'utils/util'; | ||
import CircularProgress from './Atoms/CircularProgress'; | ||
|
||
export default function InstanceLoadingPill({ | ||
progress_percent = 0, | ||
}: { | ||
progress_percent?: number; | ||
}) { | ||
const stateColor = stateToColor['Starting']; | ||
|
||
return ( | ||
<button | ||
className={clsx( | ||
'flex flex-row items-center gap-x-1.5', | ||
'rounded-md py-1 px-2', | ||
'text-medium font-bold leading-5 tracking-medium', | ||
'text-white/50 ui-checked:text-gray-300', | ||
'ui-checked:bg-gray-800 ui-checked:outline ui-checked:outline-1 ui-checked:outline-fade-700 ui-not-checked:hover:bg-gray-800', | ||
'focus-visible:outline-none enabled:focus-visible:ring-4 enabled:focus-visible:ring-blue-faded/50' | ||
)} | ||
> | ||
<div className="h-4 w-4"> | ||
<CircularProgress | ||
progress_percent={progress_percent} | ||
></CircularProgress> | ||
</div> | ||
|
||
<p className="grow truncate text-left italic"> | ||
Setting up... ({Math.round(progress_percent * 100)}%) | ||
</p> | ||
<FontAwesomeIcon | ||
icon={faCircle} | ||
className={`select-none ${stateColor} text-[8px]`} | ||
/> | ||
</button> | ||
); | ||
} |