├── .gitignore
├── LICENSE
├── README.md
├── org.md
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.gitignore.io/api/node,macos,windows
3 |
4 | ### macOS ###
5 | # General
6 | .DS_Store
7 | .AppleDouble
8 | .LSOverride
9 |
10 | # Icon must end with two \r
11 | Icon
12 |
13 | # Thumbnails
14 | ._*
15 |
16 | # Files that might appear in the root of a volume
17 | .DocumentRevisions-V100
18 | .fseventsd
19 | .Spotlight-V100
20 | .TemporaryItems
21 | .Trashes
22 | .VolumeIcon.icns
23 | .com.apple.timemachine.donotpresent
24 |
25 | # Directories potentially created on remote AFP share
26 | .AppleDB
27 | .AppleDesktop
28 | Network Trash Folder
29 | Temporary Items
30 | .apdisk
31 |
32 | ### Node ###
33 | # Logs
34 | logs
35 | *.log
36 | npm-debug.log*
37 | yarn-debug.log*
38 | yarn-error.log*
39 |
40 | # Runtime data
41 | pids
42 | *.pid
43 | *.seed
44 | *.pid.lock
45 |
46 | # Directory for instrumented libs generated by jscoverage/JSCover
47 | lib-cov
48 |
49 | # Coverage directory used by tools like istanbul
50 | coverage
51 |
52 | # nyc test coverage
53 | .nyc_output
54 |
55 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
56 | .grunt
57 |
58 | # Bower dependency directory (https://bower.io/)
59 | bower_components
60 |
61 | # node-waf configuration
62 | .lock-wscript
63 |
64 | # Compiled binary addons (https://nodejs.org/api/addons.html)
65 | build/Release
66 |
67 | # Dependency directories
68 | node_modules/
69 | jspm_packages/
70 |
71 | # TypeScript v1 declaration files
72 | typings/
73 |
74 | # Optional npm cache directory
75 | .npm
76 |
77 | # Optional eslint cache
78 | .eslintcache
79 |
80 | # Optional REPL history
81 | .node_repl_history
82 |
83 | # Output of 'npm pack'
84 | *.tgz
85 |
86 | # Yarn Integrity file
87 | .yarn-integrity
88 |
89 | # dotenv environment variables file
90 | .env
91 |
92 | # parcel-bundler cache (https://parceljs.org/)
93 | .cache
94 |
95 | # next.js build output
96 | .next
97 |
98 | # nuxt.js build output
99 | .nuxt
100 |
101 | # vuepress build output
102 | .vuepress/dist
103 |
104 | # Serverless directories
105 | .serverless
106 |
107 | ### Windows ###
108 | # Windows thumbnail cache files
109 | Thumbs.db
110 | ehthumbs.db
111 | ehthumbs_vista.db
112 |
113 | # Dump file
114 | *.stackdump
115 |
116 | # Folder config file
117 | [Dd]esktop.ini
118 |
119 | # Recycle Bin used on file shares
120 | $RECYCLE.BIN/
121 |
122 | # Windows Installer files
123 | *.cab
124 | *.msi
125 | *.msix
126 | *.msm
127 | *.msp
128 |
129 | # Windows shortcuts
130 | *.lnk
131 |
132 |
133 | # End of https://www.gitignore.io/api/node,macos,windows
134 | *.sublime-project
135 | *.sublime-workspace
136 | package-lock.json
137 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Thinkmill
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Thinkmill Design System Style Guide
2 |
3 | Important Note: This style guide is currently very WIP
4 |
5 | ---
6 |
7 | ## What is this style guide?
8 |
9 | This style guide documents the standards for building and maintaining design systems we follow at Thinkmill along with explaining the reasoning for our decisions and tooling.
10 |
11 | This style guide is intended to be a living representation of how Thinkmill works with design systems. Over time, the recommendations will change as our tools and workflows evolve. While the guide is designed holistically, the tools and decisions in this guide can be used independently of each other.
12 |
13 | ## Who is this style-guide for?
14 |
15 | This style-guide is intended to be opinionated, and focused on the kinds of work that Thinkmill does. Many decision inherently have trade-offs and the trade-offs made in this style-guide might not be the right ones for every company. We document these decisions fastidiously, and encourage you to use the bits that make sense for you.
16 |
17 | ## Concepts
18 |
19 | > What is a design system? Purpose, Goals, Reasoning.
20 |
21 | "A Design System is an artefact of the culture and collaboration in your company" -- Dom
22 |
23 | > Need to either cover or link out to methodolgy here, see [Dom's first notes on this](https://github.com/Thinkmill/design-system/blob/master/org.md)
24 |
25 | ### Terminology
26 |
27 | (all wip and in need of further discussion)
28 |
29 | - Design Language
30 |
31 | > The collection of design decisions that represent a company, brand or product. Usually includes colour, typography, spacing, language and tone of voice, illustrations and iconography, visual style, and patterns of applying all of these to reference designs.
32 |
33 | - Design System
34 |
35 | > The composition of components, patterns and processes that is consumable, documented, published to be able to be reusable and scalable in a business domain
36 |
37 | - Design Tokens
38 |
39 | > Implementation agnostic variables that describe the subset of values core to a design system.
40 |
41 | - Theme
42 |
43 | > A customisable subset of design decisions that expresses sweeping style changes through the system.
44 |
45 | - Packs
46 |
47 | > A cluster of design tokens grouped according to how they should be used. See [Packs](#Packs)
48 |
49 | - Packages
50 |
51 | > A collection of one or more components or utilities, conceptually identifiable as a concern of the design system, documented and published to a package registry.
52 |
53 | - Components
54 |
55 | > Components encapsulate functionality that renders a `view` with `styles` based on a `state`.
56 | > See [Components](#Components)
57 |
58 | - State
59 |
60 | > The combination of component that affect the appearance or behaviour of the
61 |
62 | - Controllable State
63 |
64 | > This is an important concept regarding how state can be optionally provided to a component, along with a callback that is invoked when the state should change. The fallback behaviour is for the component to manage the state and default callback behaviour internally.
65 |
66 | - Switches
67 |
68 | > Props that can change the appearance and/or behaviour of a component. Often selected from a set of possible values. Examples include appearance or color of a button, first day of the week in a calendar, etc.
69 |
70 | # Design Tokens
71 |
72 | ## Global Tokens
73 |
74 | ## Packs
75 |
76 | # Theming
77 |
78 | # Components
79 |
80 | > NOTE: Here we describe developing React components for a design system. The principles are largely translatable to React Native projects as well, but other frameworks and technologies are out of scope for our style guide at this time.
81 |
82 | > TODO: Review [React Patterns](https://reactpatterns.com) for inspiration - this does a good job of presenting various technical approaches you can take in React, and we can learn from the way it is organised and presented!
83 |
84 | Components encapsulate functionality that renders a `view` with `styles` based on a `state`.
85 |
86 | `(state) => ({ styles, view })`
87 |
88 | We also recognise functional building blocks and controllers that are used by components to manage state, side effects and other concerns.
89 |
90 | ## Package Structure
91 |
92 | > TODO: this needs to go hand-in-hand with some more depth around how documentation and examples are developed and published to make sense.
93 |
94 | ```
95 | - docs/
96 | - examples/
97 | - src/
98 | - index.js
99 | - styles.js
100 | - tests/
101 | - package.json
102 | ```
103 |
104 | ## Types
105 |
106 | Use [TypeScript](https://www.typescriptlang.org).
107 |
108 | Among other things, it'll help you easily generate [Documentation](#Documentation) for your component APIs.
109 |
110 | ## API Design
111 |
112 | ## State Management
113 |
114 | > needs content from @jedwatson and @simonswiss.
115 |
116 | > There's definitely stuff here from treatise on state we need to clarify
117 |
118 | > But beyond that we should also have stuff around the different kinds of UI state (Mike R.)
119 |
120 | ## Styles
121 |
122 | Use [emotion](https://emotion.sh/) with the [css prop](https://emotion.sh/docs/css-prop).
123 |
124 | Specify styles in a function that is invoked with the current state of the component and design tokens, and return a css object:
125 |
126 | ```js
127 | const getButtonStyles = ({ isPressed, tokens }) => ({
128 | background: isPressed ? 'blue' : 'white',
129 | text: !isPressed ? 'blue' : 'white',
130 | });
131 |
132 | export const Button = ({ children, ...props }) => {
133 | const { isPressed, events } = useButton(props);
134 | const styles = getButtonStyles({ isPressed });
135 | return (
136 |
139 | );
140 | };
141 | ```
142 |
143 | For how to allow style overrides, see [Composition](#Composition)
144 |
145 | ### Why?
146 |
147 | Emotion gives us several benefits over other approaches:
148 |
149 | - Styles can be composed directly, without introducing the need for additional components
150 | - Dynamic styles (and the props or state they are based on) can easily be codified in the `getStyles()` function
151 | - Automatic SSR support with no additional server or build configuration required (this is important when publishing packages to npm that should have no understanding of where or how they may be used)
152 |
153 | > Performance notes?
154 |
155 | > Best practice for structuring styles in react.
156 |
157 | ## Accessibility
158 |
159 | > Resources for best practices around accessibility
160 | https://www.wuhcag.com/wcag-checklist/
161 | https://inclusive-components.design/
162 | https://www.udacity.com/course/web-accessibility--ud891
163 | https://a11yproject.com
164 |
165 | > Dom to provide (?)
166 |
167 | ## Composition
168 |
169 | ### Props
170 | > reflected attributes as props
171 | > props best practices
172 |
173 | ### Types of Components
174 |
175 | When thinking about composition in a design system, it's helpful to break down the components in your design system into the following types:
176 | _Note that a package in the design system may include one or multiple components, of the following types. Not all components in a package must be exported._
177 |
178 | - **Elements**
179 | - design system components that do not have internally managed state that reflect styles and attributes onto a dom element.
180 | - **Primitives**
181 | - design system components that do have internally managed state generally only consist of one primary identifiable component.
182 | - **Compound Components**
183 | - design system components that consist of multiple primitives.
184 | - **Composite Components**
185 | - components comprised of multiple components some of which are published elsewhere in the design system.
186 |
187 | The term "stateful", as applied to components, may mean state that is managed internally by the component or accepted as props.
188 |
189 | ### Spreading props and attributes into Views
190 |
191 | Prop spreading is a amenable pattern if there is only one primary dom element.
192 | Prop spreading is not as fine if you have multiple meaningful dom elements in your component. In these situations it is best to have a more targeted strategy for passing attributes and props down to key elements ([see overrides](#Overrides)).
193 |
194 | ### Wrapper Components
195 |
196 | Wrap components to add features, rather than blowing out the complexity of your low-level components, and their increasing API/prop surface area.
197 |
198 | For example, if your basic button takes an `isPressed` prop, and you want to add a toggle button to your design system, you can achieve the effect by creating a wrapping component that manages the toggle state:
199 |
200 | ```js
201 | const ToggleButton = props => {
202 | const [toggled, setToggled] = useState(false);
203 | const handleClick = e => {
204 | props.onToggle && props.onToggle(e, !toggled);
205 | setToggled(!toggled);
206 | };
207 | return ;
208 | };
209 | ```
210 |
211 | This works best when your building-block components accept semantic and granular props with a well thought out API that closely reflects the state(s) the component can be in.
212 |
213 | #### Counterpoints
214 |
215 | This can get complex if you want to compose multiple components together.
216 |
217 | ### Render Props
218 |
219 | Render props allow us to take control over the key state, attributes and styles of a particular component, while giving the user ownership over the shape of the DOM.
220 |
221 | ```js
222 | const Modal = () => ()
223 | export default () => (
224 |
225 | {({ styles, props, containerRef )) => (
226 |
227 | ...
228 |
229 | )}
230 |
231 | )
232 | ```
233 |
234 | ### Overrides
235 |
236 | Overrides allow users to make targeted changes without inheriting complexity
237 |
238 | - [Overrides / Flex / Extends] are meant for customisation that fall in the 20% case (advanced usage):
239 | - cssFn for customizing the CSS APPLICATION within a component
240 | - more explicit control over how tokens are applied
241 | _ i.e. setState in react (either a config object or a more explicit function that is passed previous state)
242 | _ for example spacing token used in padding instead of margin \* feedback loop with documented 80% case
243 | - A way for users to make stylistic changes that aren’t currently exposed as part of the theming / tokens API
244 |
245 | # Analytics
246 |
247 | Components exist in a hierarchy. Capture the context of where events are called down through the hierarchy using decorators, then bubble events up to listener components that wrap around the application.
248 |
249 | # Publishing and Versioning
250 |
251 | > See [monorepo style guide](https://github.com/Thinkmill/monorepo)
252 |
253 | # Observability
254 | > The yardstick of how understandable a system is tends to be how observable it is. - Cindy Sridharan
255 |
256 | The longevity of a design system is hinged on how understandable it is.
257 | As such, building tools and creating processes to make our design systems more understandable is incredibly important.
258 |
259 | Tools like kaelig's 'Splash' are a good example of this.
260 | > See https://twitter.com/kaelig/status/1172579203893456896
261 |
262 | # Documentation
263 |
264 | > [monorepo style guide](#)
265 |
266 | # Definition of Done
267 |
268 | > We should recommend (some derividation of) Emma Wedekind's Component Checklist here.
269 | > https://twitter.com/EmmaWedekind/status/1177248937763311617?s=20
270 |
271 | ## Design
272 |
273 | ### Accessibility
274 | - Accessible color palette
275 | - Keyboard interactions designed up front
276 | - Typescale is readable and appropriate
277 |
278 | ### Interaction
279 | - Clearly outlined specification for user interactions and / or user input.
280 |
281 | ### Context
282 | - How and why the component should be used is clearly defined.
283 |
284 | ### State
285 | - The different states the component can be in are clearly defined and designed.
286 |
287 | ### Content
288 | - Defined guideliens around content for and with the component.
289 |
290 | ### Customisation
291 | - `The component has defined aspects which are custommizable. If applicable, as well as the corresponding values.` - Emma Wedekind
292 |
293 | ### Responsiveness
294 | - How the component scales across varying viewport sizes and screen resolutions is clearly defined.
295 | - How the component scales within a grid.
296 |
297 | ## Engineering
298 |
299 | ### Accessibility
300 | - Components are AA compliant
301 |
302 | ### Responsiveness
303 | - The component responds gracefully to different viewport sizes.
304 | - The component responds gracefully to changes within a grid.
305 |
306 | ### State
307 | - This component includes all of the neutral, hover, focus and disabled states as defined in design.
308 |
309 | ### Customization
310 | - Component has clear patterns for customisations, as per design. (see overrides)
311 |
312 | ### Error Handling
313 | - This component handles errors gracefully
314 |
315 | ### Browser Compatibility
316 | - IE11+
317 | - Polyfills provided for newer technologies.
318 |
319 | ### Testing:
320 | - Unit tests
321 | - Integration tests
322 | - Cross browser tests.
323 |
324 | ## Documentation
325 |
326 | ### Properties
327 | - The props of the component and its exported subcomponents are clearly defined and described.
328 |
329 | ### Interactive Examples
330 | - Common and best patterns for usage are clearly defined and illustrated with examples.
331 |
332 | ### Code snippets
333 | - Interactive examples should be accompanied by code snippets
334 |
335 | ### Context Definition
336 | - When, where, how to use the component.
337 | - Related components
338 |
339 | ### Wireframe view of component
340 | > Dan to add more about this
341 |
342 |
343 | # Development
344 | >
345 |
346 | # Testing
347 |
--------------------------------------------------------------------------------
/org.md:
--------------------------------------------------------------------------------
1 | # How to get started with Design Systems in an organization
2 |
3 | 1. [Ask questions and listen](#ask-questions-and-listen)
4 | 1. [Define DS team](#define-ds-team)
5 | 1. [UI-inventory](#ui-inventory)
6 | 1. [Tech-inventory](#tech-inventory)
7 | 1. [Grouping](#grouping)
8 | 1. [Naming](#naming)
9 | 1. [Decisions](#decisions)
10 | 1. [Design Tokens](#design-tokens)
11 | 1. [Design language](#design-language)
12 | 1. [Contribution model](#contribution-model)
13 | 1. [Playback session for the company](#playback-session-for-the-company)
14 | 1. [Breaking changes](#breaking-changes)
15 | 1. [Distribution](#distribution)
16 | 1. [Documentation](#documentation)
17 |
18 | ## Ask questions and listen
19 |
20 | - Find out about the progress of the design
21 | - Find out about the progress of a component lib
22 | - Find out if the design already follows a component lib like symbols in Sketch shared with designers
23 | - Find out what the dominate tech stack is on the front end
24 | - Find out about how designers and developers work together
25 | - What does the handover look like?
26 | - Is there wire-framing, user-research, content guidelines
27 |
28 | ## Define DS team
29 |
30 | Look to make use of the right roles. The best roles for the DS team would be:
31 | - **Designers**
32 | - **Front-end developers**
33 | - **Accessibility experts**
34 | - **Content strategists**
35 | - **Researchers**
36 | - **Product managers**
37 |
38 | Find the right people to join from other parts of your company and make them champions.
39 | Not everyone has to be in the team directly to help and be a champion.
40 |
41 |
42 | ## UI-inventory
43 |
44 | - Get all components together
45 | - Get all colors together
46 | - Get all text styles together (ignore only color)
47 | - Get all icons together (Iconography and other images)
48 |
49 | ## Tech-inventory
50 |
51 | - Determine the stack(s)
52 | - Find component libs (there are usually a bunch)
53 | - Find out restrictions, eg access to GitHub, npm etc
54 | - Talk to devs in projects and see how they work
55 | - What js solution works best?
56 | - What css solution works best?
57 |
58 | ## Grouping
59 |
60 | Come up with groups of UI bits that make sense from a dev and design perspective.
61 | Make sure you have designers and developers in the room.
62 | If you have a content person please include them, they are exceptionally good at grouping things.
63 |
64 | ## Naming
65 |
66 | Now the hard part: name the groups.
67 | Have a look at theming, consistent naming for priorities like `primary`, `secondary` etc
68 | Make sure you name things semantically so you communicate what a thing is for by it's name.
69 |
70 | ## Decisions
71 |
72 | Note down all decisions and capture the reasons behind them all.
73 |
74 | ## Design Tokens
75 |
76 | Tokenize your Design language.
77 | Create tokens for:
78 | - color
79 | - spacing
80 | - type
81 | - packs
82 |
83 | Group things together and name them like `page-headline` would be a pack consistent of:
84 | - `font-family`
85 | - `font-size`
86 | - `line-height`
87 | - `font-weight`
88 |
89 | but not `color` or `spacing` as those are different tokens.
90 |
91 | ## Design language
92 |
93 | Try to make your tokens your design language and document it as such.
94 | Explain where things are used and where things are not used.
95 | This should be your first deliverable.
96 |
97 | ## Contribution model
98 |
99 | https://medium.com/eightshapes-llc/team-models-for-scaling-a-design-system-2cf9d03be6a0
100 | How should we collaborate together?
101 | How can issues be raised?
102 | How owns what?
103 |
104 | ## Playback session for the company
105 |
106 | Take your company on the journey by playing back what you learned so far.
107 | Do a session every two weeks and tell them what you got so far, what you explore, what hasn't worked.
108 |
109 | ## Breaking changes
110 |
111 | How will you break your components and communicate the impact of that break?
112 | How will you version things?
113 | What impact will a breaking change have on your consumers?
114 |
115 | ## Distribution
116 |
117 | How do you deliver the DS?
118 | What do your consumers have access to?
119 |
120 | ## Documentation
121 |
122 | Who will you document for?
123 | How will you document?
124 | Where?
125 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "design-system-guide",
3 | "version": "0.0.1",
4 | "description": "A guide for building, maintaining and collaborating on design-systems at Thinkmill",
5 | "main": "index.js",
6 | "repository": "https://github.com/Thinkmill/design-system.git",
7 | "author": "Thinkmill",
8 | "license": "MIT"
9 | }
10 |
--------------------------------------------------------------------------------