@mindvalley/design-system 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -235
- package/README.md +11 -17
- package/dist/b2b.d.ts +31 -95
- package/dist/b2b.d.ts.map +1 -1
- package/dist/b2b.js +1 -1
- package/dist/b2b.js.map +1 -1
- package/dist/tailwind/plugins/tokens/b2b/typography.d.ts +4 -1
- package/dist/tailwind/plugins/tokens/b2b/typography.d.ts.map +1 -1
- package/dist/tailwind/plugins/tokens/b2b/typography.js +25 -25
- package/dist/tailwind/plugins/tokens/mindvalley/typography-gsf.d.ts +15 -0
- package/dist/tailwind/plugins/tokens/mindvalley/typography-gsf.d.ts.map +1 -0
- package/dist/tailwind/plugins/tokens/mindvalley/typography-gsf.js +77 -0
- package/dist/tailwind/plugins/tokens/mindvalley/typography.d.ts.map +1 -1
- package/dist/tailwind/plugins/tokens/mindvalley/typography.js +420 -60
- package/dist/tailwind/plugins/typography-gsf.d.ts +31 -0
- package/dist/tailwind/plugins/typography-gsf.d.ts.map +1 -0
- package/dist/tailwind/plugins/typography-gsf.js +130 -0
- package/docs/README.md +25 -0
- package/docs/RELEASING.md +9 -9
- package/docs/USAGE.md +129 -131
- package/docs/token-validation.md +298 -0
- package/docs/typography/README.md +58 -0
- package/docs/typography/migration.md +166 -0
- package/docs/typography/setup.md +366 -0
- package/package.json +10 -3
- package/docs/CONTRIBUTION.md +0 -262
- package/docs/typography-fonts.md +0 -552
- package/docs/typography-token-pipeline-b2b.md +0 -156
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const plugin_1 = __importDefault(require("tailwindcss/plugin"));
|
|
7
|
+
const casing_1 = require("../../helpers/casing");
|
|
8
|
+
const dimens_1 = require("../../helpers/dimens");
|
|
9
|
+
const typography_1 = __importDefault(require("./tokens/b2b/typography"));
|
|
10
|
+
const typography_gsf_1 = __importDefault(require("./tokens/mindvalley/typography-gsf"));
|
|
11
|
+
const brandMapping = {
|
|
12
|
+
mindvalley: typography_gsf_1.default,
|
|
13
|
+
b2b: typography_1.default,
|
|
14
|
+
};
|
|
15
|
+
function typographyPlugin(options = {}) {
|
|
16
|
+
return ({ addUtilities, theme }) => {
|
|
17
|
+
const { casing = casing_1.CASINGS.kebabCase, breakpoints = {}, prefix = '', brands = ['mindvalley'], } = options;
|
|
18
|
+
const tabletBreakpoint = breakpoints.tablet ?? theme('screens.md', '768px');
|
|
19
|
+
const desktopBreakpoint = breakpoints.desktop ?? theme('screens.lg', '1024px');
|
|
20
|
+
const typographyClassDeclarations = {};
|
|
21
|
+
for (const brand of brands) {
|
|
22
|
+
const brandTypography = brandMapping[brand];
|
|
23
|
+
if (!brandTypography) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const processedTypography = processTypography(brandTypography, tabletBreakpoint, desktopBreakpoint);
|
|
27
|
+
const casedTypography = convertObjectKeysToCasedClassNames(processedTypography, casing, prefix);
|
|
28
|
+
Object.assign(typographyClassDeclarations, casedTypography);
|
|
29
|
+
}
|
|
30
|
+
addUtilities(typographyClassDeclarations);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function processTypography(typography, tabletBreakpoint, desktopBreakpoint) {
|
|
34
|
+
const result = {};
|
|
35
|
+
for (const key of Object.keys(typography)) {
|
|
36
|
+
const isDesktop = key.endsWith('-desktop');
|
|
37
|
+
const isTablet = key.endsWith('-tablet');
|
|
38
|
+
const isMobile = key.endsWith('-mobile');
|
|
39
|
+
const baseTypography = typography[key];
|
|
40
|
+
const baseKey = isDesktop || isTablet || isMobile
|
|
41
|
+
? (0, casing_1.toCamelCase)(key.replace(/-desktop$|-tablet$|-mobile$/g, ''))
|
|
42
|
+
: key;
|
|
43
|
+
if (isDesktop) {
|
|
44
|
+
const existing = result[baseKey] || {};
|
|
45
|
+
result[baseKey] = {
|
|
46
|
+
...existing,
|
|
47
|
+
[`@media (min-width: ${desktopBreakpoint})`]: { ...baseTypography },
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
else if (isTablet) {
|
|
51
|
+
const existing = result[baseKey] || {};
|
|
52
|
+
result[baseKey] = {
|
|
53
|
+
...existing,
|
|
54
|
+
[`@media (min-width: ${tabletBreakpoint})`]: { ...baseTypography },
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else if (isMobile) {
|
|
58
|
+
const existing = result[baseKey] || {};
|
|
59
|
+
result[baseKey] = { ...baseTypography, ...existing };
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
result[baseKey] = baseTypography;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
function convertObjectKeysToCasedClassNames(typography, casing = casing_1.CASINGS.kebabCase, prefix = '') {
|
|
68
|
+
const mapKey = (key) => {
|
|
69
|
+
let className;
|
|
70
|
+
switch (casing) {
|
|
71
|
+
case casing_1.CASINGS.snakeCase:
|
|
72
|
+
className = (0, casing_1.toSnakeCase)(key);
|
|
73
|
+
break;
|
|
74
|
+
case casing_1.CASINGS.camelCase:
|
|
75
|
+
className = (0, casing_1.toCamelCase)(key);
|
|
76
|
+
break;
|
|
77
|
+
case casing_1.CASINGS.pascalCase:
|
|
78
|
+
className = (0, casing_1.toPascalCase)(key);
|
|
79
|
+
break;
|
|
80
|
+
case casing_1.CASINGS.kebabCase:
|
|
81
|
+
className = (0, casing_1.toKebabCase)(key);
|
|
82
|
+
break;
|
|
83
|
+
case casing_1.CASINGS.noCase:
|
|
84
|
+
className = (0, casing_1.toNoCase)(key);
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
console.error(`${casing} is currently not supported in this function, reverting to default ${casing_1.CASINGS.kebabCase}. Please raise an issue ticket here[https://github.com/mindvalley/mv-design-system]`);
|
|
88
|
+
className = (0, casing_1.toKebabCase)(key);
|
|
89
|
+
}
|
|
90
|
+
return prefix ? `.${prefix}${className}` : `.${className}`;
|
|
91
|
+
};
|
|
92
|
+
function mapVal(value) {
|
|
93
|
+
const res = {};
|
|
94
|
+
const variationSettings = [];
|
|
95
|
+
Object.keys(value).forEach((key) => {
|
|
96
|
+
const propValue = value[key];
|
|
97
|
+
if (key === 'lineHeight' && typeof propValue === 'string') {
|
|
98
|
+
res[key] = (0, dimens_1.lineHeightToRem)(propValue);
|
|
99
|
+
}
|
|
100
|
+
else if (['fontSize', 'letterSpacing'].includes(key) && typeof propValue === 'string') {
|
|
101
|
+
res[key] = (0, dimens_1.strPxToRemStr)(propValue);
|
|
102
|
+
}
|
|
103
|
+
else if (key === 'fontWidth' && typeof propValue === 'number') {
|
|
104
|
+
variationSettings.push(`"wdth" ${propValue}`);
|
|
105
|
+
}
|
|
106
|
+
else if (key === 'slant' && typeof propValue === 'number') {
|
|
107
|
+
variationSettings.push(`"slnt" ${propValue}`);
|
|
108
|
+
}
|
|
109
|
+
else if (typeof propValue === 'object' && propValue !== null) {
|
|
110
|
+
res[key] = mapVal(propValue);
|
|
111
|
+
}
|
|
112
|
+
else if (propValue !== undefined) {
|
|
113
|
+
res[key] = propValue;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
if (variationSettings.length > 0) {
|
|
117
|
+
res.fontVariationSettings = variationSettings.join(', ');
|
|
118
|
+
}
|
|
119
|
+
return res;
|
|
120
|
+
}
|
|
121
|
+
return mapObj(typography, mapKey, mapVal);
|
|
122
|
+
}
|
|
123
|
+
function mapObj(obj, keyMapFn, valueMapFn) {
|
|
124
|
+
const result = {};
|
|
125
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
126
|
+
result[keyMapFn(key)] = valueMapFn(value);
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
exports.default = plugin_1.default.withOptions(typographyPlugin);
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Documentation
|
|
2
|
+
|
|
3
|
+
These guides cover how to use the Mindvalley Design System in your projects - from installing tokens to configuring Tailwind plugins for typography, colors, icons, and wordmarks.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
New here? Start with the [Usage Guide](usage.md) for installation and basic setup.
|
|
8
|
+
|
|
9
|
+
## Guides
|
|
10
|
+
|
|
11
|
+
| Topic | Guide | What You'll Learn |
|
|
12
|
+
|-------|-------|-------------------|
|
|
13
|
+
| Colors | [Usage → Colors](usage.md#-colors) | Tailwind config, multi-brand setup, gradients |
|
|
14
|
+
| Typography | [Typography Guide](typography/README.md) | Font setup, class reference, plugin options |
|
|
15
|
+
| Icons | [Usage → Icons](usage.md#-icons) | Brand, UI, and category icons with sprites |
|
|
16
|
+
| Wordmarks | [Usage → Wordmarks](usage.md#-wordmarks) | Trainer and topic wordmarks |
|
|
17
|
+
|
|
18
|
+
## Migration
|
|
19
|
+
|
|
20
|
+
- [Sharp Grotesk → Google Sans Flex](typography/migration.md) - Migrate to the new variable font system
|
|
21
|
+
|
|
22
|
+
## Contributing
|
|
23
|
+
|
|
24
|
+
- [Development Guide](../CONTRIBUTING.md) - Setup, commits, build process
|
|
25
|
+
- [Release Process](releasing.md) - Semantic versioning and publishing
|
package/docs/RELEASING.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
# Releasing 🚀
|
|
2
2
|
|
|
3
3
|
By default, semantic-release uses the [Angular Commit Message Conventions](https://www.conventionalcommits.org/en/v1.0.0-beta.4/) and triggers releases based on the following rules:
|
|
4
4
|
|
|
5
|
-
| Commit | Release Type | Semver update type
|
|
6
|
-
|
|
7
|
-
| Commit with breaking change | Breaking release | Major release e.g 1.x.x -> 2.x.x
|
|
8
|
-
| Commit with type `feat` | Feature release |
|
|
9
|
-
| Commit with type `fix` | Fix
|
|
10
|
-
| Commit with type `perf` |
|
|
5
|
+
| Commit | Release Type | Semver update type |
|
|
6
|
+
|-----------------------------|------------------|-----------------------------------|
|
|
7
|
+
| Commit with breaking change | Breaking release | Major release e.g 1.x.x -> 2.x.x |
|
|
8
|
+
| Commit with type `feat` | Feature release | Minor release e.g 1.2.x -> 1.3.x |
|
|
9
|
+
| Commit with type `fix` | Fix release | Patch release e.g 1.2.3 -> 1.2.4 |
|
|
10
|
+
| Commit with type `perf` | Performance fix | Patch release e.g 1.2.3 -> 1.2.4 |
|
|
11
11
|
|
|
12
12
|
Only the above type of commits will trigger a release.
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ More detailed explanation can be found on the [semantic release steps documentat
|
|
|
23
23
|
|
|
24
24
|
After release and publishing, the package should be available as a [scoped npm package](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages) and is on npm as [@mindvalley/design-system](https://www.npmjs.com/package/@mindvalley/design-system).
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
## Trusted publishing
|
|
27
27
|
|
|
28
28
|
Releases run through the GitHub Actions workflow [`release.yml`](../.github/workflows/release.yml) using [npm trusted publishing](https://docs.npmjs.com/trusted-publishers). The workflow:
|
|
29
29
|
|
|
@@ -34,4 +34,4 @@ Releases run through the GitHub Actions workflow [`release.yml`](../.github/work
|
|
|
34
34
|
|
|
35
35
|
If the workflow fails, re-run it from the Actions tab after addressing the underlying error. No manual npm publishing is expected under normal circumstances.
|
|
36
36
|
|
|
37
|
-
Jump to the [usage guide](
|
|
37
|
+
Jump to the [usage guide](usage.md) to understand how to use the published package in your repo.
|
package/docs/USAGE.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Usage guide
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
2
4
|
|
|
3
5
|
### Using npm or yarn
|
|
4
6
|
|
|
@@ -69,9 +71,59 @@ and override the redefined colors using the B2B-specific colors.
|
|
|
69
71
|
}
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
#### Tailwind v4
|
|
75
|
+
|
|
76
|
+
Tailwind v4 uses a CSS-first approach and doesn't require a config file by default. However, to use the design system colors, you'll need to create a config file and load it with the `@config` directive.
|
|
77
|
+
|
|
78
|
+
**Step 1: Create `tailwind.config.js`**
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
// tailwind.config.js
|
|
82
|
+
import { colors } from '@mindvalley/design-system'
|
|
83
|
+
|
|
84
|
+
export default {
|
|
85
|
+
theme: {
|
|
86
|
+
colors: {
|
|
87
|
+
...colors
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
For B2B projects:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
// tailwind.config.js
|
|
97
|
+
import { colors } from '@mindvalley/design-system'
|
|
98
|
+
import { colors as b2bColors } from '@mindvalley/design-system/b2b'
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
theme: {
|
|
102
|
+
colors: {
|
|
103
|
+
...colors,
|
|
104
|
+
...b2bColors
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Step 2: Load the config in your CSS**
|
|
111
|
+
|
|
112
|
+
```css
|
|
113
|
+
/* app.css */
|
|
114
|
+
@import "tailwindcss";
|
|
115
|
+
@config "./tailwind.config.js";
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Step 3: Use color classes as normal**
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<div class="bg-brand-accent text-white">...</div>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Why the override?
|
|
73
125
|
|
|
74
|
-
Both brands share color names, but their hues and shades
|
|
126
|
+
Both brands share color names, but their hues and shades differ. The override ensures B2B developers get brand-specific shades.
|
|
75
127
|
|
|
76
128
|
Here is the full list of [B2B colors](https://www.figma.com/file/1EPj7v5H5JhP2d0v2h8QeC/B2B-Foundations?type=design&node-id=1-395&mode=design&t=SY5HTy1zbFO5p80n-0).
|
|
77
129
|
|
|
@@ -98,7 +150,7 @@ Will give you purple wave gradient.
|
|
|
98
150
|
|
|
99
151
|
If you'd like other custom names, you can make [tailwindcss color customizations](https://tailwindcss.com/docs/customizing-colors#using-the-default-colors) to the provided values and use them in your code.
|
|
100
152
|
|
|
101
|
-
|
|
153
|
+
### 2. Using CSS-in-JS
|
|
102
154
|
|
|
103
155
|
1. Install the design system. See [installation](#using-npm-or-yarn).
|
|
104
156
|
2. Use the [ES module](#es-module-syntax) syntax to import your module and include it in your code.
|
|
@@ -126,104 +178,46 @@ If you'd like other custom names, you can make [tailwindcss color customizations
|
|
|
126
178
|
|
|
127
179
|
## 🖋️ Typography
|
|
128
180
|
|
|
129
|
-
### Loading
|
|
130
|
-
|
|
131
|
-
Before using the typography plugin, you need to load the required fonts. The design system provides pre-generated `@font-face` declarations that you can easily import.
|
|
132
|
-
|
|
133
|
-
#### Recommended Method: Package Import
|
|
181
|
+
### Loading typography fonts
|
|
134
182
|
|
|
135
|
-
|
|
183
|
+
Before using the typography plugin, load the required fonts:
|
|
136
184
|
|
|
137
|
-
**
|
|
185
|
+
**Google Sans Flex**
|
|
138
186
|
|
|
139
|
-
```
|
|
140
|
-
|
|
187
|
+
```html
|
|
188
|
+
<!-- Add to your HTML <head> -->
|
|
189
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
190
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
191
|
+
<link href="https://fonts.googleapis.com/css2?family=Google+Sans+Flex:wdth,wght@75..125,100..900&display=swap" rel="stylesheet">
|
|
141
192
|
```
|
|
142
193
|
|
|
143
|
-
**
|
|
194
|
+
> **Note:** Google Sans Flex requires the variable font version to support width variations. Fontsource currently only offers static font weights, which won't work with this typography system.
|
|
144
195
|
|
|
145
|
-
|
|
146
|
-
import '@mindvalley/design-system/typography/b2b/fonts.css'
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**For projects using both brands:**
|
|
196
|
+
**Sharp Grotesk**
|
|
150
197
|
|
|
151
198
|
```javascript
|
|
152
199
|
import '@mindvalley/design-system/typography/mindvalley/fonts.css'
|
|
153
|
-
import '@mindvalley/design-system/typography/b2b/fonts.css'
|
|
154
200
|
```
|
|
155
201
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
> 💡 **Note**: For detailed framework-specific examples (Next.js, Vite, Phoenix, CSS-in-JS solutions, etc.), see the comprehensive [Typography Font Loading Guide](typography-fonts.md).
|
|
159
|
-
|
|
160
|
-
> ⚠️ **PostCSS Users**: If you're using `@import` in SCSS/CSS files with `postcss-import`, you need to configure it to resolve from `node_modules`. See the [PostCSS configuration example](typography-fonts.md#using-with-postcss-and-scss-import-phoenix-webpack--scss) for details.
|
|
161
|
-
|
|
162
|
-
#### Alternative Method: Manual CSS
|
|
163
|
-
|
|
164
|
-
If you prefer more control or need to customize the font loading, you can manually add the `@font-face` declarations to your CSS:
|
|
165
|
-
|
|
166
|
-
```css
|
|
167
|
-
/* Font files are served via Fastly CDN under Mindvalley assets and
|
|
168
|
-
managed via platform backoffice
|
|
169
|
-
|
|
170
|
-
Note: Each font file has a single weight baked into the font name
|
|
171
|
-
(e.g., "Sharp Grotesk Cyr Medium 20" contains Medium, "Sharp Grotesk Cyr Semibold 20" weight of 600).
|
|
172
|
-
Using font-weight: auto allows the browser to use the font's intrinsic weight.
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
|
-
@font-face {
|
|
176
|
-
font-family: "Sharp Grotesk Cyr Medium 22";
|
|
177
|
-
font-weight: auto;
|
|
178
|
-
font-display: swap;
|
|
179
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/b61f86ec-3dbd-4674-907a-f3f26f5101ce.woff2") format("woff2");
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
@font-face {
|
|
183
|
-
font-family: "Sharp Grotesk Cyr Semibold 20";
|
|
184
|
-
font-weight: auto;
|
|
185
|
-
font-display: swap;
|
|
186
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/85092275-d096-483e-a271-7d6094cafca1.woff2") format("woff2");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
@font-face {
|
|
190
|
-
font-family: "Sharp Grotesk Cyr Medium 20";
|
|
191
|
-
font-weight: auto;
|
|
192
|
-
font-display: swap;
|
|
193
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/faf3d1e3-d18c-461e-aafa-9e56f9f16ce0.woff2") format("woff2");
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
@font-face {
|
|
197
|
-
font-family: "Sharp Grotesk Cyr Medium 19";
|
|
198
|
-
font-weight: auto;
|
|
199
|
-
font-display: swap;
|
|
200
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/9f7eea7d-ba59-4ee1-85a6-3ac45f23239c.woff2") format("woff2");
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
@font-face {
|
|
204
|
-
font-family: "Sharp Grotesk Cyr Book 19";
|
|
205
|
-
font-weight: auto;
|
|
206
|
-
font-display: swap;
|
|
207
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/0982041e-3874-48dc-bba5-a15c6fb960d1.woff2") format("woff2");
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
@font-face {
|
|
211
|
-
font-family: "Sharp Grotesk Cyr Book Itl 19";
|
|
212
|
-
font-weight: auto;
|
|
213
|
-
font-display: swap;
|
|
214
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/2ba064b8-f0d5-48e4-a790-d7b90d5d2db5.woff2") format("woff2");
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
Both methods are valid, but the package import is easier to maintain and ensures you always have the latest font definitions.
|
|
202
|
+
> 📖 For framework-specific examples (Next.js, React, Vite, Vue, Phoenix) see the [Typography Setup Guide](typography/setup.md).
|
|
219
203
|
|
|
220
204
|
### Typography plugin (TailwindCSS)
|
|
221
205
|
|
|
222
|
-
|
|
206
|
+
We provide a TailwindCSS typography plugin that lets developers use Figma typography class names directly, without configuring font sizes, line heights, or font families manually.
|
|
207
|
+
|
|
208
|
+
> ⚠️ **Important:** Typography classes are already responsive - don't add screen prefixes!
|
|
209
|
+
>
|
|
210
|
+
> ```html
|
|
211
|
+
> <!-- ❌ Bad -->
|
|
212
|
+
> <h1 class="title-bold-5 md:title-bold-3">Hello</h1>
|
|
213
|
+
>
|
|
214
|
+
> <!-- ✅ Good -->
|
|
215
|
+
> <h1 class="title-bold-5">Hello</h1>
|
|
216
|
+
> ```
|
|
223
217
|
|
|
224
218
|
#### How to use it?
|
|
225
219
|
|
|
226
|
-
|
|
220
|
+
To match Figma typography values in your code:
|
|
227
221
|
|
|
228
222
|
1. Install the design system as described in the [install section](#using-npm-or-yarn).
|
|
229
223
|
|
|
@@ -231,6 +225,20 @@ Let's say that you are trying to codify a button from a Figma design, and you wa
|
|
|
231
225
|
|
|
232
226
|
3. Require and use the Tailwind typography plugin in your `tailwind.config.js` file.
|
|
233
227
|
|
|
228
|
+
**Google Sans Flex (Recommended):**
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
module.exports = {
|
|
232
|
+
...
|
|
233
|
+
plugins: [
|
|
234
|
+
require('@mindvalley/design-system/dist/tailwind/plugins/typography-gsf.js')()
|
|
235
|
+
],
|
|
236
|
+
...
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Sharp Grotesk (Legacy):**
|
|
241
|
+
|
|
234
242
|
```js
|
|
235
243
|
module.exports = {
|
|
236
244
|
...
|
|
@@ -239,14 +247,19 @@ Let's say that you are trying to codify a button from a Figma design, and you wa
|
|
|
239
247
|
],
|
|
240
248
|
...
|
|
241
249
|
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
> 📖 **Migrating?** See the [GSF Migration Guide](typography/migration.md) for details on switching from Sharp Grotesk to Google Sans Flex.
|
|
242
253
|
|
|
243
|
-
|
|
254
|
+
<!-- -->
|
|
255
|
+
|
|
256
|
+
> ⚠️ **Tailwind v4:** Tailwind v4 does not use js config files. To use the typography plugins see [Tailwind v4 typography Setup guide](typography/setup.md#tailwind-v4-setup) for details.
|
|
244
257
|
|
|
245
258
|
4. Find the name to use by inspecting the selected text on the Figma design file.
|
|
246
259
|
|
|
247
260
|

|
|
248
261
|
|
|
249
|
-
|
|
262
|
+
1. Use the class name as follows. Remember to adjust that according to the casing option if you are not using the default.
|
|
250
263
|
|
|
251
264
|
```html
|
|
252
265
|
<p class="button-text">...</p>
|
|
@@ -265,7 +278,10 @@ Here is how to pass the casing:
|
|
|
265
278
|
module.exports = {
|
|
266
279
|
...
|
|
267
280
|
plugins: [
|
|
268
|
-
|
|
281
|
+
// GSF plugin
|
|
282
|
+
require('@mindvalley/design-system/dist/tailwind/plugins/typography-gsf.js')({ casing: "noCase" }),
|
|
283
|
+
// Or Sharp Grotesk plugin
|
|
284
|
+
// require('@mindvalley/design-system/dist/tailwind/plugins/typography.js')({ casing: "noCase" }),
|
|
269
285
|
],
|
|
270
286
|
...
|
|
271
287
|
}
|
|
@@ -280,26 +296,9 @@ Here is how to pass the casing:
|
|
|
280
296
|
}
|
|
281
297
|
```
|
|
282
298
|
|
|
283
|
-
#####
|
|
284
|
-
|
|
285
|
-
The resulting typography classes are responsive for two screen sizes: desktop and mobile/tablet.
|
|
286
|
-
You don't need to add screen prefixes to the CSS classes.
|
|
287
|
-
|
|
288
|
-
For example, the `title-bold-5` class includes media queries for both desktop and mobile/tablet, so there's no need to add custom media queries in the markup. Here's an example of the CSS for `title-bold-5`:
|
|
299
|
+
##### Generated CSS reference
|
|
289
300
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
```html
|
|
293
|
-
<h1 class="title-bold-5 md:title-bold-3">Hello World!</h1>
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
###### Good ✅
|
|
297
|
-
|
|
298
|
-
```html
|
|
299
|
-
<h1 class="title-bold-5">Hello World!</h1>
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
Since the typography classes are responsive, you don't need to add media queries to the CSS classes. For example, the `title-bold-5` class includes media queries for both desktop and mobile/tablet, so there's no need to add custom media queries in the markup. Here's an example of the CSS for `title-bold-5`:
|
|
301
|
+
Here's an example of the responsive CSS generated for `title-bold-5`:
|
|
303
302
|
|
|
304
303
|
```css
|
|
305
304
|
.title-bold-5 {
|
|
@@ -319,7 +318,7 @@ Since the typography classes are responsive, you don't need to add media queries
|
|
|
319
318
|
|
|
320
319
|
#### Configuring the brand
|
|
321
320
|
|
|
322
|
-
The
|
|
321
|
+
The design system supports multiple brands: Mindvalley (core) and B2B. Each brand has typography tokens for consistent styling across projects.
|
|
323
322
|
|
|
324
323
|
To configure the typography for a specific brand within your TailwindCSS setup, you will need to adjust your `tailwind.config.js` file to include the brand-specific typography tokens.
|
|
325
324
|
|
|
@@ -366,7 +365,7 @@ Note: B2b brand builds on top of the core brand typography with an additional sp
|
|
|
366
365
|
|
|
367
366
|
Browse [B2B foundations figma file](https://www.figma.com/file/1EPj7v5H5JhP2d0v2h8QeC/B2B-Foundations?type=design&node-id=139-11&mode=design&t=SY5HTy1zbFO5p80n-0) to see the specific typography.
|
|
368
367
|
|
|
369
|
-
#### Configuring the
|
|
368
|
+
#### Configuring the prefix
|
|
370
369
|
|
|
371
370
|
To customize the class names further, you can prepend a prefix to all typography class names generated by the plugin. This is particularly useful for specific naming conventions.
|
|
372
371
|
|
|
@@ -383,8 +382,9 @@ module.exports = {
|
|
|
383
382
|
],
|
|
384
383
|
...
|
|
385
384
|
}
|
|
385
|
+
```
|
|
386
386
|
|
|
387
|
-
Output
|
|
387
|
+
**Output:**
|
|
388
388
|
When using `mv-type--`, the generated CSS class will look like this:
|
|
389
389
|
|
|
390
390
|
```css
|
|
@@ -405,15 +405,15 @@ You'll need to make the plugin aware of the `breakingPoint` boundary between the
|
|
|
405
405
|
...
|
|
406
406
|
theme: {
|
|
407
407
|
screens: {
|
|
408
|
-
'
|
|
409
|
-
'
|
|
410
|
-
'
|
|
411
|
-
'
|
|
408
|
+
'sm': '480px',
|
|
409
|
+
'md': '992px',
|
|
410
|
+
'lg': '1024px',
|
|
411
|
+
'xl': '1280px',
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
plugins: [
|
|
415
415
|
/* Passing the identifier of the screen size to use as the breakingPoint */
|
|
416
|
-
require('@mindvalley/design-system/dist/tailwind/plugins/typography.js')({ breakingPoint: '
|
|
416
|
+
require('@mindvalley/design-system/dist/tailwind/plugins/typography.js')({ breakingPoint: 'md'}),
|
|
417
417
|
],
|
|
418
418
|
...
|
|
419
419
|
}
|
|
@@ -436,13 +436,11 @@ You'll need to make the plugin aware of the `breakingPoint` boundary between the
|
|
|
436
436
|
}
|
|
437
437
|
```
|
|
438
438
|
|
|
439
|
-
You can find the full list of typography
|
|
439
|
+
You can find the full list of typography definitions here 👉 [Figma typography](https://www.figma.com/file/Gmdp0kAAYsmBgCthFjGkpY/MV-Core?node-id=5593%3A26473&t=3PPGng5xmhzaFyRe-0)
|
|
440
440
|
|
|
441
441
|
## ©️ Icons
|
|
442
442
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
Our icon collection is meticulously organized into three distinct categories, each serving a unique purpose within your applications. Here's a breakdown of these categories:
|
|
443
|
+
Icons are organized into three categories:
|
|
446
444
|
|
|
447
445
|
1. **Brand Icons**: These icons are specific to branding and include logos, trademarks, etc.
|
|
448
446
|
2. **UI Icons**: Designed to enhance user interface aesthetics and usability.
|
|
@@ -451,12 +449,12 @@ Our icon collection is meticulously organized into three distinct categories, ea
|
|
|
451
449
|
All icons are available as single icons or as combined sets in an svg sprite.
|
|
452
450
|
|
|
453
451
|
> A sprite is a single image file which contains multiple graphics. By using sprites, you can load multiple icons with a single HTTP request.
|
|
454
|
-
|
|
452
|
+
>
|
|
455
453
|
> See the [Working Figma file for icons](https://www.figma.com/file/0b2swzflgtIMoELPgj4TVI/MV-Icons?node-id=203:3)
|
|
456
454
|
|
|
457
455
|
Accessing the icons for your project is a straightforward process. We provide a single npm package with different ways of accessing icons.
|
|
458
456
|
|
|
459
|
-
|
|
457
|
+
### Installing the icons
|
|
460
458
|
|
|
461
459
|
You will have to have the mindvalley design system npm package installed to access the icons. See the [installation guide](#using-npm-or-yarn).
|
|
462
460
|
|
|
@@ -515,10 +513,10 @@ For example:
|
|
|
515
513
|
|
|
516
514
|
For a detailed overview of the available icons in each category and brand, refer to the following:
|
|
517
515
|
|
|
518
|
-
1. [B2B Icons](
|
|
519
|
-
2. [Mindvalley
|
|
520
|
-
3. [Mindvalley
|
|
521
|
-
4. [Mindvalley UI Icons](
|
|
516
|
+
1. [B2B UI Icons](brands/b2b/icons/ui-icons.md)
|
|
517
|
+
2. [Mindvalley Brand Icons](brands/mindvalley/icons/brand-icons.md)
|
|
518
|
+
3. [Mindvalley Category Icons](brands/mindvalley/icons/categories.md)
|
|
519
|
+
4. [Mindvalley UI Icons](brands/mindvalley/icons/ui-icons.md)
|
|
522
520
|
|
|
523
521
|
b) **Legacy Method (a) (To be deprecated) - category-specific directories with no brand**
|
|
524
522
|
|
|
@@ -558,9 +556,9 @@ And here are the path conventions to follow:
|
|
|
558
556
|
|
|
559
557
|
For a detailed overview of the available icons in each category, refer to the following:
|
|
560
558
|
|
|
561
|
-
1. [
|
|
562
|
-
2. [
|
|
563
|
-
3. [
|
|
559
|
+
1. [Brand Icons](icons/brand-icons.md)
|
|
560
|
+
2. [UI Icons](icons/ui-icons.md)
|
|
561
|
+
3. [Category Icons](icons/categories.md)
|
|
564
562
|
|
|
565
563
|
b) **Legacy Method (b) (To be deprecated) - combined directory/sprite**
|
|
566
564
|
|
|
@@ -597,7 +595,7 @@ Below are instructions for integrating icons in different types of projects incl
|
|
|
597
595
|
|
|
598
596
|
##### With Vue.js
|
|
599
597
|
|
|
600
|
-
There are plenty of JS
|
|
598
|
+
There are plenty of JS libraries to use here but the recommended one is [vue-svg-sprite](https://github.com/thierrymichel/vue-svg-sprite).
|
|
601
599
|
|
|
602
600
|
##### Using vue-svg-sprite
|
|
603
601
|
|
|
@@ -728,11 +726,11 @@ And finally use the sprite using the icon id.
|
|
|
728
726
|
<%= svg_icon "chevron-right-filled", class: "w-5 h-5 fill-current inline-block" %>
|
|
729
727
|
```
|
|
730
728
|
|
|
731
|
-
> Note: You can
|
|
729
|
+
> Note: You can also use the [SvgSprite](https://hexdocs.pm/svg_sprite/SvgSprite.html) library, which works well with the category-specific directory structure.
|
|
732
730
|
|
|
733
731
|
💡 Tip
|
|
734
732
|
|
|
735
|
-
Icon
|
|
733
|
+
Icon names and previews are in the [Accessing the icons](#accessing-the-icons) section. Sample preview:
|
|
736
734
|
|
|
737
735
|

|
|
738
736
|
|