Closed alex-ketch closed 5 years ago
To expand on:
We build our own system as outlined above, but don't have layered themes. Instead we decouple as much of our logic as possible from our framework specific components, and share it across multiple UI-specific components. (Here's a way to theme Material Design for the web)
A real possibility is that even if we do go with a fully custom solution with a swappable theming layers, we still won't be a native citizen of any ecosystem without heavy interference at the component/markup level, and we will always feeling a bit out of place. An example of this are the skins for Bulma and Bootstrap which are "inspired" by Material and Fluent designs, and they get close to replicating the design systems, but fall short of the real thing.
An option we could explore would be to accept the inevitability of having to use different markup, and work to create "renderless" components. These would encapsulate all of the logic, shareable across all systems, but would require customization at the render layer. The benefit of this is that we can pull in the official design systems of the respective platform and integrate it with our requirements. Downside being that we'd likely end up changing markup for even moderately complex components.
Some reading material regarding this topic:
Bulma themes for:
Bootstrap themes for:
@nokome and I spoke over video yesterday and agreed that we'd like to explore the initial proposal of using Tailwind to develop our own system, and strive to maintain a single content markup structure. For logic layer we'd like to use React, while decoupling as much of the logic from the view as possible.
We'll go with a semi-monorepo approach, keeping brand assets, documentation, core styles inside this repo. However for the view layer specific variants (e.g stencila-style-react
), we'll have a separate repository.
I'll be starting work on this today in a new branch.
@alex-ketch @jwijay and I spoke over video yesterday and agreed to:
style
to designa
and make it a "design system" repo (not just CSS)Initial packages developed in this repo (following a Māori number nomenclature) will be:
@stencila/style-stencila-tahi
- current Bulma based styles for Stencila DS@stencila/style-stencila-rua
- Tailwind based styles for Stencila DS in https://github.com/stencila/designa/pull/10@stencila/style-material-rua
- Tailwind based styles for Material DS in https://github.com/stencila/designa/pull/10@stencila/components-rua
- StencilJS based Web Components that use rua
CSS Modules and will be used in thema
and gsuita
in the shorterm, and elsewhere in the longer term.I'm unsure where our Storybook config would live. Ideally it would be at the top level of this repo and pull in the other packages for display.
@nokome As mentioned on Zulip, in reworking the structure I came to believe that we shouldn't incorporate numbering into the package names, and instead use the version
field inside the package(.json). I think this is the more idiomatic way of handling and communicating evolution of packages.
As for the current iteration of the style
repo, I don't think it's worth it to port the current Bulma based styles into the new monorepo structure, and instead have pushed a branch called v1
. This way any back ported changes can be applied and published from that branch.
Closing this as done.
We have a few active projects with differing style requirements, and more projects are likely to come in the future.
To keep development manageable, consistent, and streamlined, I propose structuring this project into following areas of concern:
The big question is, how important is it for us to share work between the different visual layers? Do we instead fully invest in a third party design system, and can we even do that considering the list of targets above?
Proposal
I suggest we use Tailwind to skip the first layer of structural/layout styling. The composable nature lends itself well to building custom designs while abstracting away a lot of the boilerplate. This means we can we can delegate a lot of the structural/layout to an existing framework, letting us concentrate on fleshing out our own design system (the Visual Modifiers part). The ability to extract component level classes from identified patterns will help with consistency within and across projects, as well as allow us to create themed variants for different visual styles. The components should be built up in an Atomic way, reflecting both our design and development processes.
Brand assets are mainly for sharing things like logos, colors, icons, and fonts, amongst various projects, and can be split up into multiple sub-packages if we'd like.
Documentation
We should better utilize Storybook.js to create and document our components. I suggest selecting a logic layer to both build our framework-specific component library as well as to document the CSS-only framework.
While this does go against the idea of framework agnostic design systems, I think it will reduce overhead of maintaining two sets of documentation, a pure HTML and a JS framework variants. We could also look into deriving the pure HTML documentation (with just the CSS class names), from the framework specific one.
Distribution
Due to the close dependency of the various projects, I think it would make sense to have a monorepo managed by a tool like Lerna to allow working and publishing changes across projects easier.
Drawbacks
Prior Art
A good example of such a system in use is Microsoft's Fabric UI. The project has an underlying CSS package, and is consumed by several different framework-specific implementation. Please see how they declare and use a Button component in React.
Design Systems
Frameworks to Consider
Logic Layer
The likely de-facto candidate is React. However an interesting candidate to keep an eye on could be Svelte if we are interested in producing very small/AMP like publications. The elimination factor for Svelte right now is complete lack of TypeScript support.
Articles
Alternatives