-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tutorial): create a useMarketingContent hook and use it for tuto…
…rial link
- Loading branch information
1 parent
5e97d59
commit b01da95
Showing
3 changed files
with
125 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { useAdapterName } from "./useAdapterName"; | ||
|
||
type MarketingContent = { | ||
tutorial: { | ||
link: { | ||
title: string; | ||
url: string; | ||
}; | ||
tooltip: { | ||
title: string; | ||
description: string; | ||
closeButton?: string; | ||
video?: { | ||
cloudName: string; | ||
publicId: string; | ||
poster: string; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
const CONTENT_BY_ADAPTER: Record<string, MarketingContent> = { | ||
"@slicemachine/adapter-next": { | ||
tutorial: { | ||
link: { | ||
title: "Academy", | ||
url: "https://prismic.io/academy/prismic-and-nextjs", | ||
}, | ||
tooltip: { | ||
title: "Need Help?", | ||
description: | ||
"Learn how to turn a Next.js website into a page builder powered by Prismic.", | ||
closeButton: "Got it", | ||
video: { | ||
cloudName: "dmtf1daqp", | ||
publicId: "Tooltips/pa-course-overview_eaopsn", | ||
poster: "/prismic-academy-101.png", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const DEFAULT_CONTENT: MarketingContent = { | ||
tutorial: { | ||
link: { | ||
title: "Tutorial", | ||
url: "https://youtube.com/playlist?list=PLUVZjQltoA3wnaQudcqQ3qdZNZ6hyfyhH", | ||
}, | ||
tooltip: { | ||
title: "Need Help?", | ||
description: | ||
"Follow our Quick Start guide to learn the basics of Slice Machine", | ||
}, | ||
}, | ||
}; | ||
|
||
export function useMarketingContent(): MarketingContent { | ||
const adapterName = useAdapterName(); | ||
if (adapterName === undefined) { | ||
return DEFAULT_CONTENT; | ||
} | ||
|
||
return CONTENT_BY_ADAPTER[adapterName] ?? DEFAULT_CONTENT; | ||
} |