cloudfour / cloudfour/cloudfour.com-patterns

Improve Design Token Story Files

Đang mở
#1,143 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
:construction_worker: dev 👷 environment
Ngôn ngữ chính
SCSS
Star
26
Fork
3
Merge trung bình
19 giờ 32 phút
Pull request đã merge (30 ngày)
81

Mô tả

Previously, we were using Theo to dynamically generate the Story files for the design tokens. When we switched to Style Dictionary, these files became manually maintained. This wouldn't be bad necessarily, except that there's a lot of code duplication between these files for generating the tables.

> Note there is one bit of code that I'd like to DRY up — at the top of most of the design token story files (see `src/tokens/*.stories.mdx`) there's a repeated bit of code to generate a table of properties. This should ideally be pulled out into a separate file. Unfortunately, when I did so, I got errors about JSX that I wasn't able to quickly resolve. I talked to @calebeby for help, and while we couldn't fix it in the time we had, he mentioned another possibility was converting it to a React component (like `ColorPalette`)

Minimum acceptance criteria for this ticket is to DRY that code up.

Extra credit would be using Style Dictionary to generate those Story files, as we were doing in Theo. That should be possible, but may be time consuming.

- [Old Theo Story Template](https://github.com/cloudfour/cloudfour.com-patterns/blob/2e00bb2893e22df5e105b1c7da58eb221bdfdea1/.theo/formats/stories.mdx.js)
- [Style Dictionary: Using a template to create a format](https://amzn.github.io/style-dictionary/#/formats?id=using-a-template-templating-engine-to-create-a-format)
- [Style Dictionary example of custom formats using templates](https://github.com/amzn/style-dictionary/tree/master/examples/advanced/custom-formats-with-templates)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách so sánh đoạn mã tạo bảng bị lặp lại ở đầu src/tokens/*.stories.mdx, sau đó xem xét component ColorPalette như một mẫu khả thi để tách ra dựa trên React. Công việc được xem là hoàn thành khi đoạn mã trùng lặp được chuyển vào một triển khai dùng chung và các file Story của design token tiếp tục tạo ra các bảng của chúng; việc tạo bằng Style Dictionary là phần cộng thêm tùy chọn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, react, storybook
Lĩnh vực
design, frontend, tooling
Loại issue
Tái cấu trúc
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
65/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.