-
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.
- Loading branch information
Showing
10 changed files
with
186 additions
and
43 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
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,72 @@ | ||
import SlButton from "@shoelace-style/shoelace/dist/react/button/index.js"; | ||
import SlIcon from "@shoelace-style/shoelace/dist/react/icon/index.js" | ||
|
||
|
||
import { WorkflowDispatchContext } from "./WorkflowContext"; | ||
import { useContext } from "react"; | ||
import { WorkflowStep } from "../utils/workflow"; | ||
import { PlayButton } from "./PlayButton"; | ||
|
||
type ShareStepProps = { | ||
title: string | ||
shareUrl: string | ||
} | ||
|
||
export const ShareStep = (props: ShareStepProps) => { | ||
const { title, shareUrl } = props | ||
const dispatch = useContext(WorkflowDispatchContext) | ||
|
||
return ( | ||
<div> | ||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 2fr 1fr', alignItems: 'center', width: '80%', margin: 'auto' }}> | ||
<SlButton | ||
size="small" | ||
style={{ justifySelf: 'center' }} | ||
onClick={() => { | ||
dispatch?.({ | ||
type: 'setStep', | ||
step: WorkflowStep.MELODY | ||
}) | ||
}}> | ||
<SlIcon name="rewind" slot="prefix"></SlIcon>🎙️ Sing | ||
</SlButton> | ||
<h3 className="step-header"> | ||
<span className="step-num">Step 5</span>: Share | ||
</h3> | ||
</div> | ||
<div className="hint"> | ||
<ul className="hint-list"> | ||
<li> | ||
If you click the button below, you can send your song to someone else | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<h4 className="title" style={{ margin: 0 }}>Song: <span className="emphasize">{title}</span></h4> | ||
<div className="step"> | ||
<div> | ||
<PlayButton /> | ||
</div> | ||
<SlButton | ||
size="medium" | ||
variant="success" | ||
style={{ justifySelf: 'center' }} | ||
onClick={async () => { | ||
if (navigator?.canShare?.()) { | ||
await navigator.share({ | ||
url: shareUrl, | ||
text: "Check out my song!", | ||
title | ||
}) | ||
} else { | ||
console.log(shareUrl) | ||
navigator.clipboard.writeText(shareUrl) | ||
} | ||
|
||
}}> | ||
<SlIcon name="send" slot="prefix"></SlIcon>Share | ||
</SlButton> | ||
</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
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 |
---|---|---|
|
@@ -3,4 +3,5 @@ export enum WorkflowStep { | |
DRUMS, | ||
CHORDS, | ||
MELODY, | ||
SHARE | ||
} |