Skip to content

Commit c391570

Browse files
authored
feat(UIPattern): base and settings (#668)
* base * finish settings * add appId * add scoping
1 parent 1a0d137 commit c391570

File tree

14 files changed

+881
-108
lines changed

14 files changed

+881
-108
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* (c) Copyright Frontify Ltd., all rights reserved. */
2+
3+
module.exports = {
4+
extends: ['@frontify/eslint-config-react', 'plugin:jsx-a11y/recommended'],
5+
plugins: ['notice'],
6+
settings: {
7+
react: {
8+
version: 'detect',
9+
},
10+
},
11+
overrides: [
12+
{
13+
files: ['*.js', '*.ts', '*.tsx'],
14+
rules: {
15+
'notice/notice': [
16+
'error',
17+
{
18+
template: '/* (c) Copyright Frontify Ltd., all rights reserved. */\n\n',
19+
messages: {
20+
whenFailedToMatch: 'No Frontify copyright header set.',
21+
},
22+
},
23+
],
24+
},
25+
},
26+
],
27+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
node_modules
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 4,
4+
"printWidth": 120,
5+
"arrowParens": "always",
6+
"endOfLine": "lf"
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# UI Pattern block
2+
3+
Inside this block, you can create and display UI Patterns.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"appId": "clmyyhwdf00010nuqq138mw3s"
3+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "ui-pattern-block",
3+
"private": true,
4+
"author": "Frontify Developers <[email protected]>",
5+
"version": "1.0.0",
6+
"main": "dist/index.js",
7+
"scripts": {
8+
"serve": "frontify-cli serve --entryPath src/index.ts",
9+
"deploy": "frontify-cli deploy --entryPath src/index.ts",
10+
"lint": "eslint .",
11+
"lint:fix": "eslint --fix .",
12+
"prettier": "prettier --check .",
13+
"prettier:fix": "prettier --write .",
14+
"typecheck": "tsc --noEmit"
15+
},
16+
"devDependencies": {
17+
"@babel/core": "^7.22.17",
18+
"@frontify/eslint-config-react": "0.16.1",
19+
"@frontify/frontify-cli": "^5.3.17",
20+
"@types/lodash-es": "^4.17.9",
21+
"@types/react": "^18.2.21",
22+
"@types/react-dom": "^18.2.7",
23+
"autoprefixer": "^10.4.15",
24+
"cypress": "^13.2.0",
25+
"eslint": "^8.48.0",
26+
"eslint-plugin-jsx-a11y": "^6.7.1",
27+
"eslint-plugin-notice": "^0.9.10",
28+
"postcss": "^8.4.29",
29+
"prettier": "^3.0.3",
30+
"sinon": "^16.0.0",
31+
"tailwindcss": "^3.3.3",
32+
"typescript": "^5.2.2"
33+
},
34+
"dependencies": {
35+
"@codesandbox/sandpack-react": "^2.7.1",
36+
"@codesandbox/sandpack-themes": "^2.0.21",
37+
"@frontify/app-bridge": "^3.0.0-beta.96",
38+
"@frontify/fondue": "12.0.0-beta.334",
39+
"@frontify/guideline-blocks-settings": "^0.29.8",
40+
"@frontify/guideline-blocks-shared": "workspace:*",
41+
"lodash-es": "^4.17.21",
42+
"react": "^18.2.0",
43+
"react-dom": "^18.2.0"
44+
}
45+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* (c) Copyright Frontify Ltd., all rights reserved. */
2+
3+
module.exports = {
4+
plugins: {
5+
tailwindcss: {},
6+
autoprefixer: {},
7+
},
8+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* (c) Copyright Frontify Ltd., all rights reserved. */
2+
3+
import { ReactElement } from 'react';
4+
import { useBlockSettings } from '@frontify/app-bridge';
5+
import { BlockProps } from '@frontify/guideline-blocks-settings';
6+
import { Sandpack, SandpackPredefinedTemplate } from '@codesandbox/sandpack-react';
7+
8+
import 'tailwindcss/tailwind.css';
9+
import '@frontify/guideline-blocks-settings/styles';
10+
11+
import { type Settings, sandpackThemeValues } from './types';
12+
13+
export const UIPatternBlock = ({ appBridge }: BlockProps): ReactElement => {
14+
const [blockSettings] = useBlockSettings<Settings>(appBridge);
15+
const { sandpackTemplate, sandpackTheme } = blockSettings;
16+
17+
return (
18+
<div className="ui-pattern-block">
19+
<Sandpack
20+
template={sandpackTemplate as SandpackPredefinedTemplate}
21+
theme={sandpackThemeValues[sandpackTheme]}
22+
/>
23+
</div>
24+
);
25+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* (c) Copyright Frontify Ltd., all rights reserved. */
2+
3+
import { UIPatternBlock } from './UIPatternBlock';
4+
import { settings } from './settings';
5+
import { defineBlock } from '@frontify/guideline-blocks-settings';
6+
7+
export default defineBlock({
8+
block: UIPatternBlock,
9+
settings,
10+
});

0 commit comments

Comments
 (0)