-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add temporal controls to skeleton
- Loading branch information
Showing
8 changed files
with
101 additions
and
39 deletions.
There are no files selected for viewing
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { style } from "@vanilla-extract/css"; | ||
|
||
export const controlBlock = style({ | ||
display: "flex", | ||
gap: "8px", | ||
}); | ||
|
||
export const controlLabel = style({}); | ||
|
||
export const controlInput = style({ | ||
flex: 1, | ||
border: "1px solid #e5e5e5", | ||
}); |
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,51 @@ | ||
import { BoxButton } from "@/seed-design/ui/box-button"; | ||
import { | ||
useSkeletonActions, | ||
useSkeletonDuration, | ||
useSkeletonGradient, | ||
useSkeletonLoading, | ||
} from "@/stores/skeleton"; | ||
import * as React from "react"; | ||
import { controlBlock, controlInput, controlLabel } from "./SkeletonControls.css"; | ||
|
||
export const SkeletonControls = () => { | ||
const isLoading = useSkeletonLoading(); | ||
const { toggleLoading, setControls } = useSkeletonActions(); | ||
const [duration, setDuration] = React.useState(useSkeletonDuration()); | ||
const [gradient, setGradient] = React.useState(useSkeletonGradient()); | ||
|
||
return ( | ||
<div> | ||
<BoxButton variant={isLoading ? "neutral" : "brand"} onClick={toggleLoading}> | ||
{isLoading ? "Stop Loading" : "Start Loading"} | ||
</BoxButton> | ||
<div> | ||
<div className={controlBlock}> | ||
<label className={controlLabel} htmlFor="duration"> | ||
Duration | ||
</label> | ||
<input | ||
className={controlInput} | ||
id="duration" | ||
value={duration} | ||
onChange={(e) => setDuration(e.target.value)} | ||
/> | ||
</div> | ||
<div className={controlBlock}> | ||
<label className={controlLabel} htmlFor="duration"> | ||
Gradient | ||
</label> | ||
<input | ||
className={controlInput} | ||
id="gradient" | ||
value={gradient} | ||
onChange={(e) => setGradient(e.target.value)} | ||
/> | ||
</div> | ||
<BoxButton type="button" onClick={() => setControls({ duration, gradient })}> | ||
적용 | ||
</BoxButton> | ||
</div> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { Stackflow } from "@/components/Stackflow"; | ||
import { LoadingTrigger } from '@/components/LoadingTrigger'; | ||
import SkeletonPulseActivity from "@/activities/skeleton/SkeletonPulseActivitiy"; | ||
import { SkeletonControls } from '@/components/SkeletonControls'; | ||
import SkeletonWaveActivity from "@/activities/skeleton/SkeletonWaveActivity"; | ||
|
||
# Skeleton | ||
|
||
### Pulse | ||
### Wave | ||
|
||
<Stackflow Activity={SkeletonPulseActivity} /> | ||
<Stackflow Activity={SkeletonWaveActivity} /> | ||
|
||
<LoadingTrigger /> | ||
<SkeletonControls /> |
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
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