@linktr.ee/create-link-app 0.3.0-next.11 → 0.3.0-next.13
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.
- package/dist/storybook/global.css +39 -0
- package/oclif.manifest.json +1 -1
- package/package.json +4 -3
- package/templates/react-ts/src/components/Layouts.tsx +57 -0
- package/templates/react-ts/src/index.tsx +18 -5
- package/templates/react-ts/src/stories/LinkApp.stories.tsx +73 -12
- package/templates/react-ts/src/types/global.d.ts +5 -1
- package/templates/react-ts/src/types/index.ts +20 -5
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* BorderRadius.Full */
|
|
3
|
+
--lt-cover-radius: 6rem;
|
|
4
|
+
--lt-cover-radius-mobile: 4rem;
|
|
5
|
+
--lt-treetop-radius-mobile: 2.5rem;
|
|
6
|
+
--lt-feature-container-radius: 2rem;
|
|
7
|
+
--lt-feature-thumbnail-radius: 1.5rem;
|
|
8
|
+
--lt-carousel-container-radius: 1.5rem;
|
|
9
|
+
--lt-carousel-thumbnail-radius: 1rem;
|
|
10
|
+
--lt-grid-container-radius: 1.25rem;
|
|
11
|
+
--lt-grid-thumbnail-radius: 0.75rem;
|
|
12
|
+
--lt-stack-container-radius: 1rem;
|
|
13
|
+
--lt-stack-thumbnail-radius: 0.65rem;
|
|
14
|
+
|
|
15
|
+
--lt-font-family: "Inter";
|
|
16
|
+
|
|
17
|
+
/* Theme */
|
|
18
|
+
--lt-color-primary: #d1c4f7;
|
|
19
|
+
--lt-color-secondary: #d1c4f7;
|
|
20
|
+
--lt-color-on-primary: #070217;
|
|
21
|
+
--lt-color-on-secondary: #070217;
|
|
22
|
+
|
|
23
|
+
--lt-color-15: rgb(14, 9, 23);
|
|
24
|
+
--lt-color-14: rgb(27, 17, 47);
|
|
25
|
+
--lt-color-13: rgb(41, 26, 70);
|
|
26
|
+
--lt-color-12: rgb(55, 34, 93);
|
|
27
|
+
--lt-color-11: rgb(69, 43, 117);
|
|
28
|
+
--lt-color-10: rgb(82, 51, 140);
|
|
29
|
+
--lt-color-9: rgb(96, 60, 163);
|
|
30
|
+
--lt-color-8: rgb(110, 68, 187);
|
|
31
|
+
--lt-color-7: rgb(128, 92, 195);
|
|
32
|
+
--lt-color-6: rgb(146, 115, 204);
|
|
33
|
+
--lt-color-5: rgb(164, 138, 212);
|
|
34
|
+
--lt-color-4: rgb(182, 162, 221);
|
|
35
|
+
--lt-color-3: rgb(201, 185, 229);
|
|
36
|
+
--lt-color-2: rgb(219, 208, 238);
|
|
37
|
+
--lt-color-1: rgb(237, 232, 246);
|
|
38
|
+
--lt-color-0: rgb(240, 236, 248);
|
|
39
|
+
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/create-link-app",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.13",
|
|
4
4
|
"description": "Create a Link App on Linktr.ee.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Linktree",
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
"/templates"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "shx rm -rf dist && tsc -b",
|
|
22
|
+
"build": "shx rm -rf dist && tsc -b && yarn copy-storybook-global-css",
|
|
23
23
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
24
24
|
"prepack": "yarn build && oclif manifest && oclif readme",
|
|
25
25
|
"test": "jest --watch",
|
|
26
26
|
"test:ci": "jest",
|
|
27
27
|
"test:cov": "jest --coverage",
|
|
28
|
-
"version": "oclif readme && git add README.md"
|
|
28
|
+
"version": "oclif readme && git add README.md",
|
|
29
|
+
"copy-storybook-global-css": "cp ./src/storybook/global.css ./dist/storybook/global.css"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@babel/core": "^7.18.2",
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SettingsData } from '../types'
|
|
2
|
+
|
|
3
|
+
const baseStyle = {
|
|
4
|
+
backgroundColor: 'var(--lt-button-color)',
|
|
5
|
+
color: 'var(--lt-primary-color)',
|
|
6
|
+
} as React.CSSProperties
|
|
7
|
+
|
|
8
|
+
const Featured = (props: SettingsData) => {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
className="px-6 pt-12 pb-11 h-full"
|
|
12
|
+
style={{
|
|
13
|
+
...baseStyle,
|
|
14
|
+
borderRadius: 'var(--lt-feature-container-radius',
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
Featured
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Carousel = (props: SettingsData) => {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
className="px-4 pt-16 pb-10 h-full"
|
|
26
|
+
style={{
|
|
27
|
+
...baseStyle,
|
|
28
|
+
borderRadius: 'var(--lt-carousel-container-radius',
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
Carousel
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const Grid = (props: SettingsData) => {
|
|
37
|
+
return (
|
|
38
|
+
<div className="px-3 py-10 h-full" style={{ ...baseStyle, borderRadius: 'var(--lt-grid-container-radius' }}>
|
|
39
|
+
Grid
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const Stack = (props: SettingsData) => {
|
|
45
|
+
return (
|
|
46
|
+
<div className="flex p-2 h-full gap-2 w-full" style={{ ...baseStyle, borderRadius: 'var(--lt-stack-container-radius' }}>
|
|
47
|
+
<div className="w-16 aspect-square"></div>
|
|
48
|
+
<h2 className="mr-16">Stack</h2>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const SheetBody = () => {
|
|
54
|
+
return <div>sheet body</div>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { Featured, Carousel, Grid, Stack, SheetBody }
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SettingsData } from './types'
|
|
1
|
+
import { Featured, Carousel, Grid, Stack, SheetBody } from './components/Layouts'
|
|
2
|
+
import { SettingsData, Layout } from './types'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function App(props: SettingsData) {
|
|
5
|
+
const { layout } = props
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
switch (layout) {
|
|
8
|
+
case Layout.stack:
|
|
9
|
+
return <Stack {...props} />
|
|
10
|
+
case Layout.grid:
|
|
11
|
+
return <Grid {...props} />
|
|
12
|
+
case Layout.carousel:
|
|
13
|
+
return <Carousel {...props} />
|
|
14
|
+
case Layout.featured:
|
|
15
|
+
return <Featured {...props} />
|
|
16
|
+
case Layout.sheetBody:
|
|
17
|
+
return <SheetBody />
|
|
18
|
+
default:
|
|
19
|
+
return <div>Unknown layout: {props.layout}</div>
|
|
20
|
+
}
|
|
8
21
|
}
|
|
9
22
|
|
|
10
23
|
export default App
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
3
3
|
import { name } from '../../manifest.json'
|
|
4
|
+
import fixture from '../../common/fixtures/props-data.json'
|
|
5
|
+
|
|
6
|
+
import { Layout } from '../types'
|
|
4
7
|
|
|
5
8
|
import LinkApp from '..'
|
|
6
9
|
|
|
10
|
+
import '../tailwind.css'
|
|
11
|
+
|
|
7
12
|
export default {
|
|
8
13
|
title: `Link App/${name}`,
|
|
9
14
|
component: LinkApp,
|
|
@@ -11,28 +16,84 @@ export default {
|
|
|
11
16
|
parameters: {
|
|
12
17
|
layout: 'fullscreen',
|
|
13
18
|
},
|
|
19
|
+
args: {
|
|
20
|
+
...fixture,
|
|
21
|
+
editing: false,
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
layout: {
|
|
25
|
+
table: {
|
|
26
|
+
disable: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
14
30
|
} as ComponentMeta<typeof LinkApp>
|
|
15
31
|
|
|
16
|
-
export const Stack: ComponentStory<typeof LinkApp> = () => (
|
|
17
|
-
<div
|
|
18
|
-
|
|
32
|
+
export const Stack: ComponentStory<typeof LinkApp> = (args) => (
|
|
33
|
+
<div
|
|
34
|
+
className="m-2"
|
|
35
|
+
style={{
|
|
36
|
+
width: 374,
|
|
37
|
+
height: 80,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<LinkApp {...args} />
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
Stack.args = {
|
|
44
|
+
layout: Layout.stack,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const Grid: ComponentStory<typeof LinkApp> = (args) => (
|
|
48
|
+
<div
|
|
49
|
+
className="m-2"
|
|
50
|
+
style={{
|
|
51
|
+
width: 183,
|
|
52
|
+
height: 240,
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<LinkApp {...args} />
|
|
19
56
|
</div>
|
|
20
57
|
)
|
|
58
|
+
Grid.args = {
|
|
59
|
+
layout: Layout.grid,
|
|
60
|
+
}
|
|
21
61
|
|
|
22
|
-
export const
|
|
23
|
-
<div
|
|
24
|
-
|
|
62
|
+
export const Carousel: ComponentStory<typeof LinkApp> = (args) => (
|
|
63
|
+
<div
|
|
64
|
+
className="m-2"
|
|
65
|
+
style={{
|
|
66
|
+
width: 224,
|
|
67
|
+
height: 296,
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<LinkApp {...args} />
|
|
25
71
|
</div>
|
|
26
72
|
)
|
|
73
|
+
Carousel.args = {
|
|
74
|
+
layout: Layout.carousel,
|
|
75
|
+
}
|
|
27
76
|
|
|
28
|
-
export const
|
|
29
|
-
<div
|
|
30
|
-
|
|
77
|
+
export const Featured: ComponentStory<typeof LinkApp> = (args) => (
|
|
78
|
+
<div
|
|
79
|
+
className="m-2"
|
|
80
|
+
style={{
|
|
81
|
+
width: 374,
|
|
82
|
+
height: 374,
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<LinkApp {...args} />
|
|
31
86
|
</div>
|
|
32
87
|
)
|
|
88
|
+
Featured.args = {
|
|
89
|
+
layout: Layout.featured,
|
|
90
|
+
}
|
|
33
91
|
|
|
34
|
-
export const
|
|
35
|
-
<div className="
|
|
36
|
-
<LinkApp
|
|
92
|
+
export const SheetBody: ComponentStory<typeof LinkApp> = (args) => (
|
|
93
|
+
<div className="m-2">
|
|
94
|
+
<LinkApp {...args} />
|
|
37
95
|
</div>
|
|
38
96
|
)
|
|
97
|
+
SheetBody.args = {
|
|
98
|
+
layout: Layout.sheetBody,
|
|
99
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
// @HACK:
|
|
1
|
+
// @HACK: These files are removed at build time, but we need it for type checking
|
|
2
2
|
declare module '*manifest.json' {
|
|
3
3
|
export const name: string
|
|
4
4
|
}
|
|
5
|
+
|
|
6
|
+
declare module '*props-data.json' {
|
|
7
|
+
export const name: string
|
|
8
|
+
}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
type LinktreeLinkContext = {
|
|
2
|
-
layout:
|
|
3
|
-
editing: boolean
|
|
4
|
-
|
|
2
|
+
layout: Layout;
|
|
3
|
+
editing: boolean;
|
|
4
|
+
borderRadius: BorderRadius;
|
|
5
|
+
};
|
|
5
6
|
|
|
6
7
|
export type SettingsData = {
|
|
7
|
-
title: string
|
|
8
|
-
} & LinktreeLinkContext
|
|
8
|
+
title: string;
|
|
9
|
+
} & LinktreeLinkContext;
|
|
10
|
+
|
|
11
|
+
export enum Layout {
|
|
12
|
+
featured = "FEATURED",
|
|
13
|
+
carousel = "CAROUSEL",
|
|
14
|
+
grid = "GRID",
|
|
15
|
+
stack = "STACK",
|
|
16
|
+
sheetBody = "SHEET_BODY",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum BorderRadius {
|
|
20
|
+
Full = "FULL",
|
|
21
|
+
Medium = "MEDIUM",
|
|
22
|
+
None = "NONE",
|
|
23
|
+
}
|