File tree Expand file tree Collapse file tree 3 files changed +27
-16
lines changed
Expand file tree Collapse file tree 3 files changed +27
-16
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ npm run serve
24244 . The Component directory must includes ` Component.vue ` and ` Component.stories.js `
25255 . ` config.js ` will automatically import all files ending in ` *.stories.js `
2626
27- ## Copywriter's notes
27+ ## Notes
2828
29- This repository contains the golden source for the [ Cosmos Glossary ] ( https://cosmos.network/glossary ) .
29+ See below for component-specific notes .
3030
31- Head to the [ Tooltip] ( ./src/Tooltip ) component for more details.
31+ * [ Tooltip] ( ./src/Tooltip )
Original file line number Diff line number Diff line change 11# Tooltips & Glossary
22
33## Structure
4- File [ dict.json ] ( ./dict.json ) contains the source for hover tooltips and the [ Cosmos Glossary ] ( https://cosmos.network/glossary ) .
4+ The component presents a tooltip (title & description) based on a dictionary .
55
6- Each item in the file has the following components:
7- * ** Identifier** : Not seen by readers, used as a lookup when defining tooltips (e.g. ` application-layer ` )
8- * ** Text** : Formatted in [ Markdown] ( https://www.markdownguide.org/basic-syntax/ ) , has a * title* and a * description* .
9- These two are separated by a newline character ` \n ` .
10-
11- ## Making tooltip/glossary changes
6+ It tries to use an external Vuex dictionary (` $store.state.glossary ` ). If it cannot be found, it falls back to [ dict.json] ( ./dict.json ) .
127
13- * Use an online Markdown editor (e.g. [ LivePreview] ( https://markdownlivepreview.com/ ) ).
14- * Keep the description in a single line. Otherwise you might break auto-wrapping of text.
15- * If you add hyperlinks, make sure they work in the preview.
16- * Paste back into [ dict.json] ( ./dict.json ) in a single line. Do not forget the separating ` \n ` .
17- * Create a pull request for review.
8+ The external dictionary must have the following structure and fields:
9+ ```
10+ {
11+ "lookup-key":
12+ {
13+ "title": "Application layer",
14+ "description": "Yada yada yada"
15+ }
16+ }
17+ ```
18+ where ` lookup-key ` is the entry-specific lookup key (e.g. * application-layer* , * blockchain* ), ` title ` and ` description `
19+ are expected key names.
Original file line number Diff line number Diff line change @@ -91,7 +91,16 @@ export default {
9191 },
9292 computed: {
9393 definition () {
94- return new MarkdownIt ().render (dict[this .value ]);
94+ var glossary = this .$store .state .glossary ;
95+ if (! glossary) {
96+ return new MarkdownIt ().render (dict[this .value ]);
97+ } else {
98+ var slug = this .value ;
99+ var title = glossary .dict [slug].title ;
100+ var description = glossary .dict [slug].description ;
101+ var value = ' # ' + title + ' \n ' + description;
102+ return new MarkdownIt ().render (value);
103+ }
95104 }
96105 },
97106 methods: {
You can’t perform that action at this time.
0 commit comments