forked from aws-samples/amplify-next-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #284 from cabcookie:weekly-plan-with-optional-steps
feat: skip actions in weekly planning
- Loading branch information
Showing
11 changed files
with
178 additions
and
25 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 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
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,13 +1,43 @@ | ||
import { FC } from "react"; | ||
import { Button } from "@/components/ui/button"; | ||
import { Loader2 } from "lucide-react"; | ||
import { FC, useState } from "react"; | ||
|
||
type PlanWeekActionProps = { | ||
label: string; | ||
skip?: () => void; | ||
}; | ||
|
||
const PlanWeekAction: FC<PlanWeekActionProps> = ({ label }) => ( | ||
<div className="border-2 border-[--context-color] rounded-md flex justify-center p-1 font-semibold"> | ||
Next Action: {label} | ||
</div> | ||
); | ||
const PlanWeekAction: FC<PlanWeekActionProps> = ({ label, skip }) => { | ||
const [skipping, setSkipping] = useState(false); | ||
|
||
const handleSkip = () => { | ||
setSkipping(true); | ||
skip?.(); | ||
}; | ||
|
||
return ( | ||
<div className="border-2 border-[--context-color] rounded-md flex justify-center p-1 font-semibold flex-col items-center text-center"> | ||
<span>Next Action: {label}</span> | ||
{skip && ( | ||
<Button | ||
size="sm" | ||
variant="link" | ||
onClick={handleSkip} | ||
className="text-muted-foreground hover:text-primary" | ||
disabled={skipping} | ||
> | ||
{!skipping ? ( | ||
"Skip" | ||
) : ( | ||
<div className="flex flex-row gap-1"> | ||
<Loader2 className="w-4 h-4 animate-spin" /> | ||
Skipping | ||
</div> | ||
)} | ||
</Button> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default PlanWeekAction; |
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
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