Skip to content

Commit 4df79b9

Browse files
committed
Add a new blog post about CC Vocabulary
1 parent ac31882 commit 4df79b9

File tree

11 files changed

+267
-0
lines changed

11 files changed

+267
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name: dhruvkb
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name: cc-vocabulary
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
title: CC Vocabulary is a new design system for Creative Commons
2+
---
3+
categories:
4+
announcements
5+
cc-vocabulary
6+
product
7+
---
8+
author: dhruvkb
9+
---
10+
pub_date: 2019-06-15
11+
---
12+
body:
13+
14+
With the development period of GSoC 2019 well under way, a number of new and
15+
improved Creative Commons apps are navigating their way to production and
16+
worldwide reception. With all this development comes one obvious challenge:
17+
*consistency* (not to mention a number of other challenges such as
18+
internationalisation and modularity).
19+
20+
The idea of a design system, to have a collection of elements and components
21+
designed cohesively to be used across the body of applications of a particular
22+
brand, is not new or even remotely my original. In fact, every organisation with
23+
more than one application should have a design system. My last project was
24+
backed by its own component library and it saved my team countless hours of
25+
bikeshedding and repetitive design iterations.
26+
27+
Contributing to CC Search in the period before GSoC made me realize the numerous
28+
areas of the project that would benefit from a pre-built library and prompted
29+
the proposal that eventually became my project. I'll cite the same example that
30+
I used in my proposal because it so clearly shows a problem and its solution.
31+
32+
Consider for example the header and footer. All CC apps have a header and a
33+
footer developed along the lines of [the
34+
homepage](https://creativecommons.org/), albeit to varying extents. However, due
35+
to the lack of a common component, every app develops its own and they end up
36+
looking like these. Calling them inconsistent would be an understatement.
37+
38+
<div>
39+
<img src="cc_home.png" alt="CC Homepage"/><br/>
40+
<small class="muted">The footer on the CC homepage</small>
41+
</div>
42+
43+
<div>
44+
<img alt="CC Search" src="cc_search.png"/><br/>
45+
<small class="muted">The footer in the CC Search app</small>
46+
</div>
47+
48+
<div>
49+
<img alt"CC GitHub" src="cc_github.png"/><br>
50+
<small class="muted">The footer on the CC Open Source site</small>
51+
</div>
52+
53+
### Enter CC Vocabulary
54+
55+
CC Vocabulary solves precisely that. It is a set of components, elements and
56+
patterns that unite Creative Commons' applications in terms of look and feel,
57+
while encapsulating and abstracting basic functionality that need not be
58+
reinvented per-app.
59+
60+
Now CC Vocabulary provides a footer (ready to use today!) that can be used on
61+
all three of the above sites, conveying the same information in the same
62+
consistent layout.
63+
64+
_"What about the different contents in the footers?"_, you ask.
65+
66+
As for the different content in all three footers, the third column is 100%
67+
customisable. So whether crediting the developers of the website, attributing
68+
the icon artists or licensing the content therein, the footer just works. And
69+
when it comes to translations, Vocabulary has you covered. Lastly, to embody the
70+
colorful world of creativity, every CC Vocabulary component can be colored. So
71+
from the blue header of CC Search to the orange one on the homepage, there's a
72+
component for everybody.
73+
74+
'Nuff said.
75+
76+
<div>
77+
<img alt="CC Vocabulary" src="cc_vocabulary.png"/><br/>
78+
<small class="muted">The footer provided by CC Vocabulary</small>
79+
</div>
80+
81+
<div>
82+
<img alt="CC Vocabulary GitHub" src="cc_vocabulary_github.png"/><br/>
83+
<small class="muted">The footer provided by CC Vocabulary customised for the CC
84+
Open Source site</small>
85+
</div>
86+
87+
<div>
88+
<img alt="CC Vocabulary Hindi" src="cc_vocabulary_hindi.png"/><br/>
89+
<small class="muted">The footer provided by CC Vocabulary in Hindi</small>
90+
</div>
91+
92+
----
93+
94+
Let's get to the nerdy stuff, the **development details**. Here's the good, the
95+
bad and the ugly of Vue development and also how all three adjectives fail to
96+
embody the one constant feeling: _challenging_!
97+
98+
### The good
99+
100+
As you've already seen, the prospects of the library in making the CC codebase
101+
modular, cleaner and i18n-ready are huge. And being written in Vue has a ton of
102+
perks, not the least of which is a future-ready, progressive framework to back
103+
the project!
104+
105+
Working in JavaScript is very different from a Python project. For instance, I
106+
had literally very little need for Docker containers in the first place as npm
107+
modules are local unlike pip, which needs Pipenv or similar to add sanity to
108+
package management.
109+
110+
Development in Vue is even more different, and even even more so when building a
111+
Webpack-based app with Vue CLI, which takes a different approach compared to
112+
React CRA. For one, there is no option to eject! So any changes to the Webpack
113+
config have to be submitted via an object in `vue.config.js` and deep merged
114+
with the existing config.
115+
116+
Then there are plugins. Plugins for Vue CLI are few and far in between but those
117+
that are work extremely well and integrate with the Vue UI, a web based
118+
management tool for Vue projects. If you haven't seen Vue UI, you should.
119+
120+
```bash
121+
[user cc-vocabulary]$ vue ui
122+
```
123+
124+
Both Vue Styleguidist, the plugin used to generate the styleguide and Vue i18n,
125+
the plugin used to provide translations work seamlessly with Vue and, with the
126+
exception of having to manually enable i18n in Styleguidist by extending the
127+
renderer in `styleguide.config.js` (more on that later), with each other.
128+
129+
Coming from a React background, the helpfulness of the Vue framework contrasts
130+
starkly with the cold stony world I was accustomed to. _"I'm beginning to enjoy
131+
JavaScript"_, a sentence I never thought I'd say.
132+
133+
So by the end of week one, I had a styleguide with a Heading component and a
134+
Docker setup to boot. I also had a ridiculously large smile from all the
135+
learning that I did. By the end of three weeks, I was the proud developer of a
136+
world-class web component framework that was beginning to have some real
137+
footing, something I had not even dreamed possible!
138+
139+
### The bad
140+
141+
In week 2, I had to develop a number of components and incorporate design
142+
tokens, a practice with origins at Salesforce. Folks wiser than myself at
143+
Salesforce came up with the idea of using design tokens to keep constants out of
144+
the design and frontend development process, abstracting the actual nitty gritty
145+
of colors and border radii behind semantic names such as `blue_light` and
146+
`radius_small`.
147+
148+
Hardcoding every single color and every single dimension in YAML files manually
149+
from little to no reference at all was a very low point in an already low week.
150+
The reason behing this pain is [CC's color
151+
palette](https://wiki.creativecommons.org/wiki/colors) which provides all values
152+
in hex `#abcdef` for the close to forty colors in the palette. Were they HSL
153+
values, it would have been extremely easy to shade the colors. If any brand aims
154+
to redo its colors, I would suggest using HSL wherein HS is used to determine a
155+
color and L is varied to determine its shades.
156+
157+
Another strange decision taken by Vue is that Vue components use a Single File
158+
Component scheme making use of `.vue` files that Webpack processes using the
159+
`vue-loader` package. Now Styleguidist and Vue i18n both add their own tags to
160+
the mix such as `<docs>` and `<i18n>` making one component file go to hundreds
161+
or even thousands of lines! In a world that taught us to decouple style from
162+
functionality, this mushing of languages did not sit well with me.
163+
164+
This catastrophe could have become ugly were it not for the benevolent `src`
165+
attribute supported by some Vue tags. I had known this for merely seconds when
166+
I found myself breaking my components down using
167+
168+
```html
169+
<style scoped lang="stylus" src="./Component.styl"></style>
170+
```
171+
172+
to store CSS separately and
173+
174+
```html
175+
<i18n src="./Component.json"></i18n>
176+
```
177+
178+
to keep translations outside of my code, thus making the file much more
179+
manageable. There is still no way to split the JS `<script>` from the HTML
180+
`<template>` without losing all autocompletion features provided by the IDE.
181+
182+
Also Styleguidist comes with a very bland default style so to make it barely
183+
presentable, one needs to override a lot of CSS styles that have absurdly high
184+
specificities. Thankfully the default design is bland, not ugly otherwise the
185+
whole thing would have been an ugly, miserable affair.
186+
187+
### The ugly
188+
189+
Incorporating translations into the project was the weirdest. With two or three
190+
commands maximum, the Vue website had translations enabled and was working
191+
perfectly. But the Styleguide would _just not render translations at all!_
192+
193+
It took close to three days to even figure out why. Once I misinterpreted the
194+
cause of the error, broke the entire styleguide and had to
195+
196+
```bash
197+
[user cc-vocabulary]$ git reset --hard HEAD
198+
```
199+
200+
to even get things to work. _"Use VCS."_, proved one again.
201+
202+
Finally I had to register the i18n plugin separately for the styleguide, install
203+
the middleware on all components and add a locale selector to every preview box
204+
across the styleguide by extending and overriding the preview component. The
205+
good folks at Styleguidist had provided for that functionality, and it revealed
206+
itself to me as I was at the very brink of losing my mind.
207+
208+
To add insult to injury, translations have to be done by hand. I know this is
209+
how the world of i18n works but it would be really magical if we had a service
210+
to do the translations automatically. Now I can write in two languages, and will
211+
translate components to the other one as best as I can. But I urge you to
212+
[contribute](https://github.com/creativecommons/cc-vocabulary) too. Together we
213+
can make CC components globally local.
214+
215+
Languages that follow an alternate orientation, such as top-to-bottom or
216+
right-to-left would pose significant difficulty to implement, having to manually
217+
render everything in an opposite or perpendicular direction gives me the chills.
218+
It's gonna be ugly.
219+
220+
**Pro-tip:** I learned that flags are a terrible way to represent language. Many
221+
languages are spoken more widely outside countries of origin (think English) and
222+
many countries are home to several languages (think India). Many large websites
223+
make the mistake of using flag alongside language names and that seems so stupid
224+
in retrospect.
225+
226+
Also one should use the native name of the language in the selector (like हिन्दी)
227+
and the universal translation icon (or some stylistic variant thereof).
228+
229+
<center>
230+
<img alt="Translate icon" src="translate.png" height="48px"/>
231+
</center>
232+
233+
----
234+
235+
### TL;DR
236+
237+
The project which takes out a lot of the hard work from frontend
238+
development has its fair share of hard work cut out for itself. The challenges
239+
ahead are plentiful, but the solutions they inspire are diamonds in their own
240+
right. It is safe to say that I can attribute my complete understanding of Vue, i18n,
241+
component libraries, styleguides and design systems to CC Vocabulary.
242+
243+
_Before we move on, let me tell you the bad and the ugly are not the norm. The
244+
good was the major portion of the project._
245+
246+
----
247+
248+
### Future
249+
250+
So as you can see CC Vocabulary represents a huge leap forward for the
251+
web-facing Creative Commons. I can't wait to see the new generation of apps by
252+
Creative Commons, _powered by CC Vocabulary_.
253+
254+
CC Vocabulary is out now, with its code, design and translations on GitHub and a
255+
live styleguide hosted on GitHub pages. Please [check it
256+
out](https://creativecommons.github.io/cc-vocabulary/) and join the discussions.
257+
Since it is too early to even call it a beta, your feedback is crucial in shaping
258+
its future and with it, the future of all Creative Commons apps.
259+
260+
Here's a sneak peek!
261+
262+
<div>
263+
<img alt="CC Vocabulary in production" src="hello.png"/><br/>
264+
<small class="muted">Say hello to CC Vocabulary!</small>
265+
</div>
Loading
Loading

0 commit comments

Comments
 (0)