Skip to content

Commit

Permalink
chore: Improved components list organization (#4643)
Browse files Browse the repository at this point in the history
## Description

1. Rename Text category to Typography
2. Move Content Block to typography
3. move Time to a standalone new "Localization" category
4. move Media section next after Typography

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
  • Loading branch information
kof authored Dec 23, 2024
1 parent 7d7c92a commit 66ff273
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
5 changes: 3 additions & 2 deletions packages/react-sdk/src/components/component-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export type WsComponentPropsMeta = z.infer<typeof WsComponentPropsMeta>;

export const componentCategories = [
"general",
"text",
"data",
"typography",
"media",
"data",
"forms",
"localization",
"radix",
"xml",
"hidden",
Expand Down
3 changes: 1 addition & 2 deletions packages/react-sdk/src/core-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ const blockTemplatePropsMeta: WsComponentPropsMeta = {
};

const blockMeta: WsComponentMeta = {
category: "data",
order: 2,
category: "typography",
type: "container",
label: "Content Block",
icon: EditIcon,
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-components-react/src/blockquote.ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const presetStyle = {
} satisfies PresetStyle<typeof defaultTag>;

export const meta: WsComponentMeta = {
category: "text",
category: "typography",
type: "container",
description:
"Use to style a quote from an external source like an article or book.",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-components-react/src/heading.ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const presetStyle = {
} satisfies PresetStyle<HeadingTags>;

export const meta: WsComponentMeta = {
category: "text",
category: "typography",
type: "container",
description:
"Use HTML headings to structure and organize content. Use the Tag property in settings to change the heading level (h1-h6).",
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-components-react/src/list-item.ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const presetStyle = {
} satisfies PresetStyle<typeof defaultTag>;

export const meta: WsComponentMeta = {
category: "general",
category: "typography",
type: "container",
constraints: {
// cannot use parent relation here
Expand All @@ -27,7 +27,7 @@ export const meta: WsComponentMeta = {
icon: ListItemIcon,
states: defaultStates,
presetStyle,
order: 4,
order: 5,
template: [
{
type: "instance",
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-components-react/src/list.ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ const presetStyle = {
} satisfies PresetStyle<ListTag>;

export const meta: WsComponentMeta = {
category: "general",
category: "typography",
type: "container",
description: "Groups content, like links in a menu or steps in a recipe.",
icon: ListIcon,
states: defaultStates,
presetStyle,
order: 3,
order: 4,
template: [
{
type: "instance",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-components-react/src/paragraph.ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const presetStyle = {
} satisfies PresetStyle<typeof defaultTag>;

export const meta: WsComponentMeta = {
category: "text",
category: "typography",
type: "container",
description: "A container for multi-line text.",
icon: TextAlignLeftIcon,
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-components-react/src/text.ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const presetStyle = {
} satisfies PresetStyle<typeof defaultTag>;

export const meta: WsComponentMeta = {
category: "text",
category: "typography",
type: "container",
description:
"A generic container for any text content that is not a heading or a link.",
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk-components-react/src/time.ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ const presetStyle = {
} satisfies PresetStyle<"time">;

export const meta: WsComponentMeta = {
category: "data",
category: "localization",
type: "container",
description:
"Converts machine-readable date and time to a human-readable format.",
icon: CalendarIcon,
states: defaultStates,
presetStyle,
order: 5,
};

export const propsMeta: WsComponentPropsMeta = {
Expand Down

0 comments on commit 66ff273

Please sign in to comment.