slice-machine-ui 1.19.2-dev-in-app-guide.3 → 1.19.2-dev-in-app-guide.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,17 +15,27 @@ import { Counter } from "@src/components/Counter";
15
15
  import { FlowerBackgroundIcon } from "@src/icons/FlowerBackgroundIcon";
16
16
  import { HelpIcon } from "@src/icons/HelpIcon";
17
17
  import { useIsEmptyProject } from "@src/hooks/useIsEmptyProject";
18
- import { useRepositoryInformation } from "@src/hooks/useRepositoryInformation";
19
18
 
20
- import { IN_APP_GUIDE_CONTENT } from "./inAppGuideContent";
19
+ import { useInAppGuideContent } from "./inAppGuideContent";
21
20
  import { useInAppGuide } from "./InAppGuideContext";
22
21
 
23
22
  export const InAppGuideDialog: FC = () => {
24
23
  const isEmptyProject = useIsEmptyProject();
25
24
  const { isInAppGuideOpen, setIsInAppGuideOpen } = useInAppGuide();
26
- const { repositoryUrl } = useRepositoryInformation();
25
+ const inAppGuideContent = useInAppGuideContent();
27
26
 
28
27
  // TODO: Use new IconButton component from editor-ui
28
+ //
29
+ // It should be used like that:
30
+ // <IconButton
31
+ // color="purple"
32
+ // radius="full"
33
+ // renderIcon={() => <HelpIcon />}
34
+ // onClick={() => {
35
+ // setIsInAppGuideOpen(!isInAppGuideOpen);
36
+ // }}
37
+ // />
38
+
29
39
  const trigger =
30
40
  isEmptyProject === false ? (
31
41
  <Box position="fixed" right={16} bottom={16}>
@@ -62,13 +72,25 @@ export const InAppGuideDialog: FC = () => {
62
72
  position="bottomRight"
63
73
  size={{
64
74
  width: 360,
65
- height: 440,
75
+ height: 456,
66
76
  }}
67
77
  >
68
- <DialogHeader title={IN_APP_GUIDE_CONTENT.title} />
78
+ <DialogHeader title={inAppGuideContent.title} />
69
79
  <DialogContent>
70
80
  <ScrollArea>
71
- {IN_APP_GUIDE_CONTENT.steps.map((content, index) => (
81
+ <Box
82
+ flexDirection="column"
83
+ padding={{ inline: 16, block: 8 }}
84
+ gap={8}
85
+ >
86
+ <Text>{inAppGuideContent.description}</Text>
87
+ </Box>
88
+
89
+ <Box>
90
+ <Separator />
91
+ </Box>
92
+
93
+ {inAppGuideContent.steps.map((content, index) => (
72
94
  <Box key={index} flexDirection="column">
73
95
  <Box flexDirection="column" padding={16} gap={8}>
74
96
  <Box alignItems="center" gap={8}>
@@ -86,11 +108,7 @@ export const InAppGuideDialog: FC = () => {
86
108
  controls
87
109
  loop
88
110
  />
89
- <Text>
90
- {typeof content.description === "function"
91
- ? content.description(repositoryUrl)
92
- : content.description}
93
- </Text>
111
+ <Text>{content.description}</Text>
94
112
  </Box>
95
113
 
96
114
  <Separator />
@@ -98,12 +116,8 @@ export const InAppGuideDialog: FC = () => {
98
116
  ))}
99
117
 
100
118
  <Box flexDirection="column" padding={16} gap={4}>
101
- <Text variant="bold">{IN_APP_GUIDE_CONTENT.successTitle}</Text>
102
- <Box flexDirection="column">
103
- {IN_APP_GUIDE_CONTENT.successSteps.map((content, index) => (
104
- <Text key={index}>• {content}</Text>
105
- ))}
106
- </Box>
119
+ <Text variant="bold">{inAppGuideContent.successTitle}</Text>
120
+ <Text>{inAppGuideContent.successDescription}</Text>
107
121
  </Box>
108
122
  </ScrollArea>
109
123
  </DialogContent>
@@ -1,60 +1,67 @@
1
- import { TextLink } from "@prismicio/editor-ui";
1
+ import { TextLink, Text } from "@prismicio/editor-ui";
2
2
 
3
- export const IN_APP_GUIDE_CONTENT = {
4
- title: "Build your first page in 5 minutes",
5
- steps: [
6
- {
7
- title: "Add slice to your page",
8
- videoUrl:
9
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/ADD_SLICE.mp4",
10
- description:
11
- "Try one of our templates to get started after the creation of your first page",
12
- },
13
- {
14
- title: "Code your page",
15
- videoUrl:
16
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/CODE_SNIP.mp4",
17
- description:
18
- "Slice Machine provides code snippets. Copy-paste them into your page component to render your page.",
19
- },
20
- {
21
- title: "Push models to the Page Builder",
22
- videoUrl:
23
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/PUSH.mp4",
24
- description:
25
- "You have just created some models, but you can't use them yet. First, you must push them to the Page Builder. The Page Builder is where you create content. Go head — push your models.",
26
- },
27
- {
28
- title: "Create your first page",
29
- videoUrl:
30
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/WRITE.mp4",
31
- description: (repositoryUrl: string) => (
32
- <>
33
- In your{" "}
34
- <TextLink href={repositoryUrl} underline>
35
- Page Builder
36
- </TextLink>
37
- , create your first page. Add slices to the page to create content.
38
- Then save and publish and come back here.
39
- </>
40
- ),
41
- },
42
- {
43
- title: "Render your page",
44
- videoUrl:
45
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/PREVIEW.mp4",
46
- description: "Run your project on localhost to see your first page.",
47
- },
48
- ],
49
- successTitle: "You have made your first page!",
50
- successSteps: [
51
- "Edit, and style your slices",
52
- "Create more pages in the Page Builder",
53
- <>
54
- Learn how to{" "}
55
- <TextLink href="TODO" underline>
56
- manage your routes
57
- </TextLink>
58
- </>,
59
- ],
60
- };
3
+ import { useRepositoryInformation } from "@src/hooks/useRepositoryInformation";
4
+
5
+ export function useInAppGuideContent() {
6
+ const { repositoryUrl } = useRepositoryInformation();
7
+
8
+ return {
9
+ title: "Build a page in 5 minutes",
10
+ description:
11
+ "Great, now that you have a page type, let's make it a live page!",
12
+ steps: [
13
+ {
14
+ title: "Add slices to your page type",
15
+ videoUrl:
16
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/ADD_SLICE.mp4",
17
+ description: "Use slice templates and add them to your page type.",
18
+ },
19
+ {
20
+ title: "Code your page",
21
+ videoUrl:
22
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/CODE_SNIP.mp4",
23
+ description:
24
+ "If you don't already have a page component, copy-paste the page snippets provided in your page type to create one.",
25
+ },
26
+ {
27
+ title: "Push to your Page Builder",
28
+ videoUrl:
29
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/PUSH.mp4",
30
+ description:
31
+ "You have just created some models, but you can't use them yet. First, you must push them to the Page Builder. The Page Builder is where you create content. Go head — push your models.",
32
+ },
33
+ {
34
+ title: "Create content",
35
+ videoUrl:
36
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/WRITE.mp4",
37
+ description: (
38
+ <>
39
+ Open your{" "}
40
+ <TextLink href={repositoryUrl} underline>
41
+ Page Builder
42
+ </TextLink>
43
+ , create a page, add slices, save and publish. Then, come back here.
44
+ </>
45
+ ),
46
+ },
47
+ {
48
+ title: "Render your page",
49
+ videoUrl:
50
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/PREVIEW.mp4",
51
+ description: (
52
+ <>
53
+ To render the page, run your project in your terminal and open
54
+ localhost to the page UID.{" "}
55
+ <Text variant="italic" component="span" sx={{}}>
56
+ Example:
57
+ </Text>{" "}
58
+ localhost:3000/my_page_uid
59
+ </>
60
+ ),
61
+ },
62
+ ],
63
+ successTitle: "Next",
64
+ successDescription:
65
+ "Create more slices and then go back to the Page Builder to build out your website.",
66
+ };
67
+ }