Skip to content

Commit 24e1d9e

Browse files
committed
done with vue typography components
1 parent 8d4da9b commit 24e1d9e

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

src/content/create-typography-components.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ In this post we will create a couple of typography components that we will use t
1313

1414
First create a folder in the components directory called `typography`. Then create a file called `HeadingOne.vue`and add the following:
1515

16-
```
16+
```javascript
1717
<template>
1818
<p class="text-4xl text-black text-bold font-display">
1919
<slot> </slot>
@@ -33,11 +33,11 @@ export default {
3333

3434
🛩️ We are creating a paragraph component with a slot inside it that will allow us to add additional content inside it.
3535

36-
🛩️ Then we given it some styles.
36+
🛩️ Then we've given it some styles.
3737

3838
Next up we are going to create similar files but we are just changing the font size. So in the same directory create a `HeadingTwo.vue` file with the following:
3939

40-
```
40+
```javascript
4141
<template>
4242
<p class="text-2xl text-black text-bold font-display">
4343
<slot> </slot>
@@ -56,7 +56,7 @@ export default {
5656

5757
Then create a `HeadingThree.vue` file with the following:
5858

59-
```
59+
```javascript
6060
<template>
6161
<p class="text-xl text-black text-bold font-display">
6262
<slot> </slot>
@@ -76,7 +76,7 @@ export default {
7676

7777
Next up create a `BodyOne.vue` file and add the following:
7878

79-
```
79+
```javascript
8080
<template>
8181
<p class="text-sm font-display text-bold text-black">
8282
<slot> </slot>
@@ -92,27 +92,25 @@ export default {
9292

9393
Now we need to create an `index.js` file that we can import all these from:
9494

95-
```
96-
import Vue from "vue";
97-
import HeadingOne from "./HeadingOne";
98-
import HeadingTwo from "./HeadingTwo";
99-
import HeadingThree from "./HeadingThree";
100-
import BodyOne from "./BodyOne";
95+
```javascript
96+
import Vue from "vue"
97+
import HeadingOne from "./HeadingOne"
98+
import HeadingTwo from "./HeadingTwo"
99+
import HeadingThree from "./HeadingThree"
100+
import BodyOne from "./BodyOne"
101101

102102
const Typography = {
103103
HeadingOne,
104104
HeadingTwo,
105105
HeadingThree,
106106
BodyOne,
107-
};
108-
109-
Object.keys(Typography).forEach((name) => {
110-
Vue.component(name, Typography[name]);
111-
});
112-
113-
export default Typography;
107+
}
114108

109+
Object.keys(Typography).forEach(name => {
110+
Vue.component(name, Typography[name])
111+
})
115112

113+
export default Typography
116114
```
117115

118116
So all we've done here is imported all those typography files, put them into an object and looped over each to instantate them as Vue components.

0 commit comments

Comments
 (0)