@linktr.ee/create-link-app 0.3.0-next.38 → 0.3.0-next.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.
- package/README.md +0 -29
- package/dist/commands/build.js +2 -3
- package/dist/commands/dev.js +1 -2
- package/dist/lib/create/create-project.js +0 -3
- package/dist/lib/deploy/pack-project.js +1 -12
- package/dist/webpack/webpack.config.js +40 -40
- package/html-template/development.html +2 -2
- package/html-template/production.html +2 -2
- package/oclif.manifest.json +1 -32
- package/package.json +5 -24
- package/templates/common/README.md +17 -38
- package/templates/common/fixtures/props-data.json +2 -1
- package/templates/common/gitignore +0 -1
- package/templates/common/settings.json +23 -11
- package/templates/react/package.json +2 -5
- package/templates/react/src/images/logo.png +0 -0
- package/templates/react/src/index.jsx +13 -4
- package/templates/react-ts/package.json +2 -5
- package/templates/react-ts/src/images/logo.png +0 -0
- package/templates/react-ts/src/index.tsx +19 -0
- package/templates/react-ts/src/types/global.d.ts +5 -11
- package/templates/react-ts/src/types/index.ts +7 -8
- package/dist/commands/generate-types.js +0 -111
- package/dist/commands/storybook.js +0 -28
- package/dist/lib/schema/compile.js +0 -30
- package/dist/postcss/postcss.config.js +0 -31
- package/dist/storybook/global.css +0 -53
- package/dist/storybook/main.js +0 -53
- package/dist/storybook/preview.js +0 -21
- package/templates/common/schema/editablePrivate.jtd.json +0 -6
- package/templates/common/schema/editablePublic.jtd.json +0 -10
- package/templates/common/schema/readonlyPrivate.jtd.json +0 -8
- package/templates/common/schema/readonlyPublic.jtd.json +0 -6
- package/templates/common/schema/system.jtd.json +0 -6
- package/templates/react/src/tailwind.css +0 -5
- package/templates/react-ts/src/App.tsx +0 -23
- package/templates/react-ts/src/Editor.tsx +0 -7
- package/templates/react-ts/src/Sheet.tsx +0 -7
- package/templates/react-ts/src/components/Layouts.tsx +0 -59
- package/templates/react-ts/src/stories/LinkApp.stories.tsx +0 -94
- package/templates/react-ts/src/stories/tailwind.sb.css +0 -5
- package/templates/react-ts/src/tailwind.css +0 -4
- package/templates/react-ts/src/types/schema/index.ts +0 -33
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
declare module '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare module '*props-data.json' {
|
|
7
|
-
export const name: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare const __LINK_TYPE_ID__: string
|
|
11
|
-
declare const __LINK_TYPE_SLUG__: string
|
|
1
|
+
declare module '*.jpg'
|
|
2
|
+
declare module '*.png'
|
|
3
|
+
declare module '*.jpeg'
|
|
4
|
+
declare module '*.gif'
|
|
5
|
+
declare module '*.svg'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type EditorProps = EditablePublicData & ReadonlyPublicData & EditablePrivateData & ReadonlyPrivateData
|
|
1
|
+
type LinktreeLinkContext = {
|
|
2
|
+
__linkUrl: string
|
|
3
|
+
}
|
|
4
|
+
export type SettingsData = {
|
|
5
|
+
toggle: boolean
|
|
6
|
+
your_name: string
|
|
7
|
+
} & LinktreeLinkContext
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const base_1 = __importDefault(require("../base"));
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
class MissingDependencyException extends Error {
|
|
10
|
-
constructor(packageName) {
|
|
11
|
-
super(`'${packageName}' is required on your system. Please refer to the create-link-app README`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const ucfirst = (str) => {
|
|
15
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
16
|
-
};
|
|
17
|
-
class GenerateTypes extends base_1.default {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.schemaDirPath = path_1.default.join(process.cwd(), '/schema');
|
|
21
|
-
this.tmpPath = path_1.default.join(process.cwd(), '/__temp__');
|
|
22
|
-
this.typesPath = path_1.default.join(process.cwd(), '/src/types/schema');
|
|
23
|
-
}
|
|
24
|
-
async run() {
|
|
25
|
-
try {
|
|
26
|
-
// Check for necessary deps
|
|
27
|
-
await this.dependOn('npx');
|
|
28
|
-
await this.dependOn('jtd-codegen');
|
|
29
|
-
await this.log('✓ All dependencies present');
|
|
30
|
-
// Ensure necessary directories exist
|
|
31
|
-
await this.cmd(`mkdir -p ${this.tmpPath} && touch ${this.tmpPath}/index.ts`);
|
|
32
|
-
await this.cmd(`mkdir -p ${this.typesPath} && touch ${this.typesPath}/index.ts`);
|
|
33
|
-
await this.log('✓ Files prepped for generation');
|
|
34
|
-
// Wipe existing types & drop comments
|
|
35
|
-
await this.cmd(`> ${this.typesPath}/index.ts`);
|
|
36
|
-
await this.cmd(`echo "/**" >> ${this.typesPath}/index.ts`);
|
|
37
|
-
await this.cmd(`echo " * These types were autogenerated by @linktr.ee/create-link-app" >> ${this.typesPath}/index.ts`);
|
|
38
|
-
await this.cmd(`echo " * https://www.npmjs.com/package/@linktr.ee/create-link-app " >> ${this.typesPath}/index.ts`);
|
|
39
|
-
await this.cmd(`echo " */" >> ${this.typesPath}/index.ts`);
|
|
40
|
-
// Generate and append types
|
|
41
|
-
await this.generateAndAppendSchemaType('editablePublic');
|
|
42
|
-
await this.log('✓ Generated EditablePublicData type');
|
|
43
|
-
await this.generateAndAppendSchemaType('readonlyPublic');
|
|
44
|
-
await this.log('✓ Generated ReadonlyPublicData type');
|
|
45
|
-
await this.generateAndAppendSchemaType('editablePrivate');
|
|
46
|
-
await this.log('✓ Generated EditablePrivateData type');
|
|
47
|
-
await this.generateAndAppendSchemaType('readonlyPrivate');
|
|
48
|
-
await this.log('✓ Generated ReadonlyPrivateData type');
|
|
49
|
-
// Clean up file formatting
|
|
50
|
-
await this.cmd(`npx prettier ${this.typesPath}/index.ts --write`);
|
|
51
|
-
await this.log('✓ All types created successfully');
|
|
52
|
-
// Garbage collect temporary dir
|
|
53
|
-
await this.cmd(`rm -rf ${this.tmpPath}`);
|
|
54
|
-
await this.log('✓ Cleanup complete');
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
await this.log(`𐄂 ERROR: ${e}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Generates a Typescript type for the schema defined in schema/<schemaName>.jtd.json
|
|
62
|
-
* and appends that type to src/types/schema/index.ts
|
|
63
|
-
*/
|
|
64
|
-
async generateAndAppendSchemaType(schemaName) {
|
|
65
|
-
// Generate schema
|
|
66
|
-
await this.cmd(`jtd-codegen ${this.schemaDirPath}/${schemaName}.jtd.json --typescript-out ${this.tmpPath} --root-name=${ucfirst(schemaName)}Data`);
|
|
67
|
-
// Strip jtd comment
|
|
68
|
-
await this.cmd(`sed '/^\\/\\//d' ${this.tmpPath}/index.ts > ${this.tmpPath}/parsed.ts`);
|
|
69
|
-
// Append to final file
|
|
70
|
-
await this.cmd(`cat ${this.tmpPath}/parsed.ts >> ${this.typesPath}/index.ts`);
|
|
71
|
-
}
|
|
72
|
-
async dependOn(dependencyName) {
|
|
73
|
-
try {
|
|
74
|
-
await this.cmd(`command -v ${dependencyName} || exit 1`);
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
throw new MissingDependencyException('prettier');
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Run a command with spawn effectively synchronously
|
|
82
|
-
*/
|
|
83
|
-
async cmd(command, opts = {
|
|
84
|
-
shell: true,
|
|
85
|
-
stdio: 'ignore',
|
|
86
|
-
}, onError) {
|
|
87
|
-
await new Promise((resolve, reject) => {
|
|
88
|
-
(0, child_process_1.spawn)(command, opts)
|
|
89
|
-
.on('error', (e) => {
|
|
90
|
-
reject(e);
|
|
91
|
-
})
|
|
92
|
-
.on('exit', (code) => {
|
|
93
|
-
if (code === 1)
|
|
94
|
-
reject({ exitCode: code });
|
|
95
|
-
})
|
|
96
|
-
.on('close', () => {
|
|
97
|
-
resolve();
|
|
98
|
-
});
|
|
99
|
-
}).catch((e) => {
|
|
100
|
-
if (onError) {
|
|
101
|
-
onError();
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
throw e;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.default = GenerateTypes;
|
|
111
|
-
GenerateTypes.description = 'Generate Typescript types from the schema definitions';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const core_1 = require("@oclif/core");
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
|
-
const base_1 = __importDefault(require("../base"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
class Storybook extends base_1.default {
|
|
11
|
-
async run() {
|
|
12
|
-
const configPath = path_1.default.resolve(__dirname, '..', 'storybook');
|
|
13
|
-
const { flags } = await this.parse(Storybook);
|
|
14
|
-
const storybook = (0, child_process_1.spawn)(`start-storybook -p ${flags.port} -c ${configPath}`, { shell: true, stdio: 'inherit' });
|
|
15
|
-
storybook.on('error', (err) => {
|
|
16
|
-
throw err;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.default = Storybook;
|
|
21
|
-
Storybook.description = 'Start the Storybook development server';
|
|
22
|
-
Storybook.flags = {
|
|
23
|
-
port: core_1.Flags.integer({
|
|
24
|
-
char: 'p',
|
|
25
|
-
description: 'Port to run the Storybook server on',
|
|
26
|
-
default: 6006,
|
|
27
|
-
}),
|
|
28
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const jtd_js_1 = __importDefault(require("ajv/dist/jtd.js"));
|
|
9
|
-
const index_js_1 = __importDefault(require("ajv/dist/standalone/index.js"));
|
|
10
|
-
const schemaNames = ['editablePublic', 'readonlyPublic', 'editablePrivate', 'readonlyPrivate', 'system'];
|
|
11
|
-
async function compileSchema() {
|
|
12
|
-
try {
|
|
13
|
-
const ajv = new jtd_js_1.default({
|
|
14
|
-
// @ts-expect-error: In JTD mode some options are not typed correctly.
|
|
15
|
-
strict: false,
|
|
16
|
-
code: { source: true, esm: true },
|
|
17
|
-
});
|
|
18
|
-
await Promise.all(schemaNames.map(async (schemaName) => {
|
|
19
|
-
const schemaPath = path_1.default.join(process.cwd(), `./schema/${schemaName}.jtd.json`);
|
|
20
|
-
const schema = await fs_extra_1.default.readJSON(schemaPath);
|
|
21
|
-
ajv.addSchema(schema, schemaName);
|
|
22
|
-
}));
|
|
23
|
-
const moduleCode = (0, index_js_1.default)(ajv);
|
|
24
|
-
return moduleCode;
|
|
25
|
-
}
|
|
26
|
-
catch (e) {
|
|
27
|
-
console.error(e);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = compileSchema;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getPostcssConfig = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const tailwindcss_1 = __importDefault(require("tailwindcss"));
|
|
9
|
-
const autoprefixer_1 = __importDefault(require("autoprefixer"));
|
|
10
|
-
const componentLibraryContentPath = path_1.default.join(require.resolve('@linktr.ee/component-library/tailwind.config').split('/').slice(0, -1).join('/'), 'dist', '**', '*.js');
|
|
11
|
-
const uiLinkKitPath = path_1.default.join(require.resolve('@linktr.ee/ui-link-kit').split('/').slice(0, -2).join('/'), '**', '*.js');
|
|
12
|
-
function getPostcssConfig({ linkTypeSlug, env = 'production' }) {
|
|
13
|
-
const isStorybook = env === 'storybook';
|
|
14
|
-
const content = [`${process.cwd()}/src/**/*.{js,jsx,ts,tsx}`, uiLinkKitPath];
|
|
15
|
-
if (isStorybook) {
|
|
16
|
-
content.push(componentLibraryContentPath);
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
...(isStorybook && { inject: { insertAtTop: true } }),
|
|
20
|
-
plugins: [
|
|
21
|
-
(0, tailwindcss_1.default)({
|
|
22
|
-
important: `[data-link-type-id=${linkTypeSlug}]`,
|
|
23
|
-
content,
|
|
24
|
-
presets: [require('@linktr.ee/component-library/tailwind.config')],
|
|
25
|
-
plugins: [],
|
|
26
|
-
}),
|
|
27
|
-
(0, autoprefixer_1.default)(),
|
|
28
|
-
],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.getPostcssConfig = getPostcssConfig;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--lt-color-primary: #849589;
|
|
3
|
-
--lt-color-on-primary: #ffffff;
|
|
4
|
-
--lt-color-on-primary-alpha: #ffffffb2;
|
|
5
|
-
|
|
6
|
-
--lt-color-secondary: #67776b;
|
|
7
|
-
--lt-color-on-secondary: #ffffffb3;
|
|
8
|
-
|
|
9
|
-
--lt-color-background: #3a463c;
|
|
10
|
-
--lt-color-on-background: #f7fdf9;
|
|
11
|
-
|
|
12
|
-
--lt-color0: #ffffff;
|
|
13
|
-
--lt-color1: #f7fdf9;
|
|
14
|
-
--lt-color2: #eef6ed;
|
|
15
|
-
--lt-color3: #e0ece2;
|
|
16
|
-
--lt-color4: #c9d5cb;
|
|
17
|
-
--lt-color5: #b6c5b7;
|
|
18
|
-
--lt-color6: #849589;
|
|
19
|
-
--lt-color7: #67776b;
|
|
20
|
-
--lt-color8: #4d5e52;
|
|
21
|
-
--lt-color9: #3a463c;
|
|
22
|
-
--lt-color10: #29382d;
|
|
23
|
-
--lt-color11: #151e16;
|
|
24
|
-
--lt-color12: #0b140c;
|
|
25
|
-
--lt-color13: #000501;
|
|
26
|
-
--lt-color14: #000000;
|
|
27
|
-
--lt-color15: #000000;
|
|
28
|
-
|
|
29
|
-
--lt-treetop-radius-mobile: 2.5rem;
|
|
30
|
-
|
|
31
|
-
--lt-cover-radius: 6rem;
|
|
32
|
-
--lt-cover-radius-mobile: 4rem;
|
|
33
|
-
|
|
34
|
-
--lt-feature-container-radius: 2rem;
|
|
35
|
-
--lt-feature-thumbnail-radius: 1.5rem;
|
|
36
|
-
|
|
37
|
-
--lt-carousel-container-radius: 1.5rem;
|
|
38
|
-
--lt-carousel-thumbnail-radius: 1rem;
|
|
39
|
-
|
|
40
|
-
--lt-grid-container-radius: 1.25rem;
|
|
41
|
-
--lt-grid-thumbnail-radius: 0.75rem;
|
|
42
|
-
|
|
43
|
-
--lt-stack-container-radius: 1rem;
|
|
44
|
-
--lt-stack-thumbnail-radius: 0.65rem;
|
|
45
|
-
|
|
46
|
-
--lt-font-family: INTER;
|
|
47
|
-
--lt-text-2xl: 1.5rem;
|
|
48
|
-
--lt-text-xl: 1.25rem;
|
|
49
|
-
--lt-text-lg: 1.125rem;
|
|
50
|
-
--lt-text-md: 1rem;
|
|
51
|
-
--lt-text-sm: 0.875rem;
|
|
52
|
-
--lt-text-xs: 0.75rem;
|
|
53
|
-
}
|
package/dist/storybook/main.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const postcss_1 = __importDefault(require("postcss"));
|
|
7
|
-
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
-
const postcss_config_1 = require("../postcss/postcss.config");
|
|
9
|
-
// Do not need to be the real values, just need to be defined for storybook
|
|
10
|
-
const linkTypeSlug = 'test-id';
|
|
11
|
-
const linkTypeId = 'testId';
|
|
12
|
-
const config = {
|
|
13
|
-
stories: [`${process.cwd()}/src/**/*.stories.@(js|jsx|ts|tsx)`],
|
|
14
|
-
addons: [
|
|
15
|
-
'@storybook/addon-links',
|
|
16
|
-
'@storybook/addon-essentials',
|
|
17
|
-
{
|
|
18
|
-
name: 'storybook-addon-turbo-build',
|
|
19
|
-
options: {
|
|
20
|
-
optimizationLevel: 2,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
/**
|
|
25
|
-
* Fix Storybook issue with PostCSS@8
|
|
26
|
-
* @see https://github.com/storybookjs/storybook/issues/12668#issuecomment-773958085
|
|
27
|
-
*/
|
|
28
|
-
name: '@storybook/addon-postcss',
|
|
29
|
-
options: {
|
|
30
|
-
cssLoaderOptions: { importLoaders: 1 },
|
|
31
|
-
postcssLoaderOptions: {
|
|
32
|
-
implementation: postcss_1.default,
|
|
33
|
-
postcssOptions: (0, postcss_config_1.getPostcssConfig)({ linkTypeSlug, env: 'storybook' }),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
framework: '@storybook/react',
|
|
39
|
-
core: {
|
|
40
|
-
builder: 'webpack5',
|
|
41
|
-
},
|
|
42
|
-
webpackFinal: async (config) => {
|
|
43
|
-
if (config.plugins?.length) {
|
|
44
|
-
// Add the DefinePlugin to the Webpack plugins array
|
|
45
|
-
config.plugins.push(new webpack_1.default.DefinePlugin({
|
|
46
|
-
__LINK_TYPE_ID__: JSON.stringify(linkTypeId),
|
|
47
|
-
__LINK_TYPE_SLUG__: JSON.stringify(linkTypeSlug),
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
return config;
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
module.exports = config;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.decorators = exports.parameters = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
require("./global.css");
|
|
9
|
-
exports.parameters = {
|
|
10
|
-
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
11
|
-
controls: {
|
|
12
|
-
matchers: {
|
|
13
|
-
color: /(background|color)$/i,
|
|
14
|
-
date: /Date$/,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
const WrapperDecorator = (storyFn) => (react_1.default.createElement("div", { style: {
|
|
19
|
-
display: 'contents',
|
|
20
|
-
}, "data-link-type-id": __LINK_TYPE_SLUG__ }, storyFn()));
|
|
21
|
-
exports.decorators = [WrapperDecorator];
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Featured, Carousel, Grid, Stack } from './components/Layouts'
|
|
2
|
-
import { AppProps, Layout } from './types'
|
|
3
|
-
|
|
4
|
-
import './tailwind.css'
|
|
5
|
-
|
|
6
|
-
function App(props: AppProps) {
|
|
7
|
-
const { layout } = props
|
|
8
|
-
|
|
9
|
-
switch (layout) {
|
|
10
|
-
case Layout.Stack:
|
|
11
|
-
return <Stack {...props} />
|
|
12
|
-
case Layout.Grid:
|
|
13
|
-
return <Grid {...props} />
|
|
14
|
-
case Layout.Carousel:
|
|
15
|
-
return <Carousel {...props} />
|
|
16
|
-
case Layout.Featured:
|
|
17
|
-
return <Featured {...props} />
|
|
18
|
-
default:
|
|
19
|
-
return <div>Unknown layout: {props.layout}</div>
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default App
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { AppProps } from '../types'
|
|
2
|
-
|
|
3
|
-
const baseStyle = {
|
|
4
|
-
backgroundColor: 'var(--lt-color-primary)',
|
|
5
|
-
color: 'var(--lt-color-on-primary)',
|
|
6
|
-
} as React.CSSProperties
|
|
7
|
-
|
|
8
|
-
const Featured = (props: AppProps) => {
|
|
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: AppProps) => {
|
|
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: AppProps) => {
|
|
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: AppProps) => {
|
|
45
|
-
return (
|
|
46
|
-
<div
|
|
47
|
-
className="flex p-2 h-full gap-4 w-full"
|
|
48
|
-
style={{
|
|
49
|
-
...baseStyle,
|
|
50
|
-
borderRadius: 'var(--lt-stack-container-radius)',
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
<div className="w-16 aspect-square"></div>
|
|
54
|
-
<h2 className="mr-20">Stack</h2>
|
|
55
|
-
</div>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { Featured, Carousel, Grid, Stack }
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
3
|
-
import manifest from '../../manifest.json'
|
|
4
|
-
import fixture from '../../fixtures/props-data.json'
|
|
5
|
-
|
|
6
|
-
import { Layout } from '../types'
|
|
7
|
-
|
|
8
|
-
import LinkApp from '..'
|
|
9
|
-
|
|
10
|
-
import './tailwind.sb.css'
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: `Link App/${manifest.name}`,
|
|
14
|
-
component: LinkApp,
|
|
15
|
-
tags: ['autodocs'],
|
|
16
|
-
parameters: {
|
|
17
|
-
layout: 'fullscreen',
|
|
18
|
-
},
|
|
19
|
-
args: {
|
|
20
|
-
...fixture,
|
|
21
|
-
editing: false,
|
|
22
|
-
},
|
|
23
|
-
argTypes: {
|
|
24
|
-
layout: {
|
|
25
|
-
table: {
|
|
26
|
-
disable: true,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
} as ComponentMeta<typeof LinkApp>
|
|
31
|
-
|
|
32
|
-
export const Stack: ComponentStory<typeof LinkApp> = (args) => (
|
|
33
|
-
<div
|
|
34
|
-
data-link-type-id={__LINK_TYPE_SLUG__}
|
|
35
|
-
style={{
|
|
36
|
-
margin: '0.5rem',
|
|
37
|
-
width: 374,
|
|
38
|
-
height: 80,
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
41
|
-
<LinkApp {...args} />
|
|
42
|
-
</div>
|
|
43
|
-
)
|
|
44
|
-
Stack.args = {
|
|
45
|
-
layout: Layout.Stack,
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const Grid: ComponentStory<typeof LinkApp> = (args) => (
|
|
49
|
-
<div
|
|
50
|
-
data-link-type-id={__LINK_TYPE_SLUG__}
|
|
51
|
-
style={{
|
|
52
|
-
margin: '0.5rem',
|
|
53
|
-
width: 183,
|
|
54
|
-
height: 240,
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
<LinkApp {...args} />
|
|
58
|
-
</div>
|
|
59
|
-
)
|
|
60
|
-
Grid.args = {
|
|
61
|
-
layout: Layout.Grid,
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export const Carousel: ComponentStory<typeof LinkApp> = (args) => (
|
|
65
|
-
<div
|
|
66
|
-
data-link-type-id={__LINK_TYPE_SLUG__}
|
|
67
|
-
style={{
|
|
68
|
-
margin: '0.5rem',
|
|
69
|
-
width: 224,
|
|
70
|
-
height: 296,
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
<LinkApp {...args} />
|
|
74
|
-
</div>
|
|
75
|
-
)
|
|
76
|
-
Carousel.args = {
|
|
77
|
-
layout: Layout.Carousel,
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const Featured: ComponentStory<typeof LinkApp> = (args) => (
|
|
81
|
-
<div
|
|
82
|
-
data-link-type-id={__LINK_TYPE_SLUG__}
|
|
83
|
-
style={{
|
|
84
|
-
margin: '0.5rem',
|
|
85
|
-
width: 374,
|
|
86
|
-
height: 374,
|
|
87
|
-
}}
|
|
88
|
-
>
|
|
89
|
-
<LinkApp {...args} />
|
|
90
|
-
</div>
|
|
91
|
-
)
|
|
92
|
-
Featured.args = {
|
|
93
|
-
layout: Layout.Featured,
|
|
94
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* These types were autogenerated by @linktr.ee/create-link-app
|
|
3
|
-
* https://www.npmjs.com/package/@linktr.ee/create-link-app
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* These are properties that the Linker can `read` and `write`, and the Visitor
|
|
8
|
-
* can `read`
|
|
9
|
-
*/
|
|
10
|
-
export interface EditablePublicData {
|
|
11
|
-
thumbnailUrl: string
|
|
12
|
-
title: string
|
|
13
|
-
url: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* These are properties that the Linker can `read`, and the Visitor can `read`
|
|
18
|
-
*/
|
|
19
|
-
export interface ReadonlyPublicData {}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* These are properties that the Linker can `read` and `write`, but the Visitor
|
|
23
|
-
* will never have access to.
|
|
24
|
-
*/
|
|
25
|
-
export interface EditablePrivateData {}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* These are properties that only the Linker can `read`. The Visitor will never
|
|
29
|
-
* have access to these properties
|
|
30
|
-
*/
|
|
31
|
-
export interface ReadonlyPrivateData {
|
|
32
|
-
httpResponseCode: number
|
|
33
|
-
}
|