Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Draft) Design Library #199

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
- [Flutter] Poligon Node support with XImage (svg)
- [Lint] Primal naming & grouping linting for better code export quality. this is tracked sperately on [lint](https://github.com/bridgedxyz/lint)

## [2022.4.1.0] - 2022-04-30

- New feature: Design Library

## [2022.4.0.3] - 2022-04-29

- New feature : Publish as website
Expand Down
3 changes: 3 additions & 0 deletions app/lib/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ButtonMakerScreen } from "@app/button-maker";
import { LayoutViewScreen } from "../pages/layout-view";
import { ComponentViewScreen } from "@app/component-manage";
import { LintScreen } from "@app/design-lint";
import { DesignLibraryScreen } from "@app/design-library";
import { PreviewScreen } from "@app/design-preview";
import { IconsScreen } from "@app/icons-loader";
import { MetaEditorScreen, BatchMetaEditor } from "@app/meta-editor";
Expand Down Expand Up @@ -66,6 +67,8 @@ function Screen(props: { screen: WorkScreen }) {
return <LayoutViewScreen />;
case WorkScreen.preview:
return <PreviewScreen />;
case WorkScreen.library:
return <DesignLibraryScreen />;
case WorkScreen.icon:
return <IconsScreen />;
case WorkScreen.lint:
Expand Down
3 changes: 3 additions & 0 deletions app/lib/routing/layout-preference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function getWorkmodeTabLayout(workspaceMode: WorkMode): TabLayout {
WorkScreen.preview,
WorkScreen.icon,
WorkScreen.layout,
WorkScreen.library,
WorkScreen.lint,
];
case WorkMode.content:
Expand Down Expand Up @@ -57,6 +58,8 @@ export function workScreenToName(appMode: WorkScreen): string {
return "live";
case WorkScreen.layout:
return "layout";
case WorkScreen.library:
return "library";
case WorkScreen.preview:
return "preview";
case WorkScreen.tool_home:
Expand Down
7 changes: 7 additions & 0 deletions app/lib/routing/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ const page_design_layout: PageConfig = {
path: "/design/layout",
};

const page_design_library: PageConfig = {
id: WorkScreen.library,
title: "Library",
path: "/design/library",
};

const page_design_preview: PageConfig = {
id: WorkScreen.preview,
title: "Preview",
Expand Down Expand Up @@ -133,6 +139,7 @@ const all_pages: PageConfig[] = [
page_design_lint,
page_design_preview,
page_design_layout,
page_design_library,
page_design_icon,
page_code_layout,
page_code_preview,
Expand Down
1 change: 1 addition & 0 deletions app/lib/routing/release-visibility-preference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const SCREEN_VISIBILITY_PREFERENCE: Map<WorkScreen, ReleaseChannel> = new Map([
[WorkScreen.about, "release"],
[WorkScreen.component, "beta"],
[WorkScreen.layout, "beta"],
[WorkScreen.library, "beta"],
[WorkScreen.icon, "release"],
[WorkScreen.preview, "release"],
[WorkScreen.live, "beta"],
Expand Down
1 change: 1 addition & 0 deletions app/lib/routing/work-screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum WorkScreen {
component = "component",
preview = "preview",
layout = "layout",
library = "library",
icon = "icon",
live = "live",
lint = "lint",
Expand Down
Empty file.
6 changes: 6 additions & 0 deletions packages/app-design-library/components/smart-preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Preview } from "@ui/previewer";
import React from "react";

export function SmartPreview() {
return <Preview auto type="static" />;
}
135 changes: 135 additions & 0 deletions packages/app-design-library/config/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import React from "react";

export type Categroy =
| "interface"
| "layout"
| "basics"
| "media"
| "seo"
| "utils";
import { keys } from "@code-features/flags";
// import type { CameraDisplayFlag } from "@code-features/flags";

export interface LibraryItem {
id: string;
name: string;
description: string | React.ReactElement;
category: Categroy;
fields?: {
[key: string]: {
placeholder?: string;
required?: boolean;
initial?: string;
type: "string";
};
};
}

const config: { [key: string]: LibraryItem } = {
// basics
[keys.flag_key__as_button]: {
id: keys.flag_key__as_button,
name: "Button",
category: "basics",
description: "Specifies the button",
},
[keys.flag_key__as_checkbox]: {
id: keys.flag_key__as_checkbox,
name: "Check box",
category: "basics",
description: "checkbox",
},
[keys.flag_key__as_input]: {
id: keys.flag_key__as_input,
name: "Input",
category: "basics",
description: "text input",
},
[keys.flag_key__as_slider]: {
id: keys.flag_key__as_slider,
name: "Slider",
category: "basics",
description: "slider",
},
[keys.flag_key__as_progress]: {
id: keys.flag_key__as_progress,
name: "Linear Progress",
category: "basics",
description: "linear progress bar",
},
// media
[keys.flag_key__camera]: {
id: keys.flag_key__camera,
name: "Camera view",
category: "media",
description: (
<p>
Specifies the view to stream the primary camera stream.{" "}
<i>(Preview will not work in Assistant due to security reasons)</i>
</p>
),
fields: {
camera: {
initial: undefined,
placeholder: "Front / Back",
type: "string",
},
},
},
[keys.flag_key__x_google_maps_view]: {
id: keys.flag_key__x_google_maps_view,
name: "Google Maps",
category: "media",
description: <p>google maps view</p>,
fields: {
location: {
required: true,
initial: "San Francisco",
placeholder: "San Francisco",
type: "string",
},
},
},
[keys.flag_key__x_youtube_view]: {
id: keys.flag_key__x_youtube_view,
name: "Youtube Video",
category: "media",
description: <p>Embed a youtube video</p>,
fields: {
video: {
required: true,
initial: "LOZuxwVk7TU",
placeholder: "youtube.com/watch?v=XXXXXXXXXX",
type: "string",
},
},
},
// utils
[keys.flag_key__autofocus]: {
id: keys.flag_key__autofocus,
name: "Auto focus",
category: "utils",
description: "Set autofocus property",
},
// seo
[keys.flag_key__as_h1]: {
id: keys.flag_key__as_h1,
name: "Heading 1",
category: "seo",
description: "Set heading 1 tag",
},
[keys.flag_key__as_h2]: {
id: keys.flag_key__as_h2,
name: "Heading 2",
category: "seo",
description: "Set heading 2 tag",
},
[keys.flag_key__as_h3]: {
id: keys.flag_key__as_h3,
name: "Heading 3",
category: "seo",
description: "Set heading 3 tag",
},
};

export default config;
Empty file.
1 change: 1 addition & 0 deletions packages/app-design-library/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { DesignLibraryScreen } from "./screen";
8 changes: 8 additions & 0 deletions packages/app-design-library/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@app/design-library",
"description": "design library (load components, add properties)",
"authors": "Grida.co",
"version": "0.0.0",
"private": false,
"dependencies": {}
}
Loading