forked from buefy/buefy
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): rewrite installation/Customization in TS (#400)
Rewrites `src/pages/installation/Customization.vue` in TypeScript. Fixes the issue that Vite complained about the missing `buefy` package, which was not actually used. This was caused by the code snippets in `Customization.vue`, which Vite conufsed with the actual code and tried to translate them. Moves these code snippets to a separate TypeScript file `usage/customization.ts`. Here is a tip for TypeScript migration: - Explicitly import and register Buefy components so that they are type-checked. Note that no type-checking is performed for globally registered components.
- Loading branch information
Showing
2 changed files
with
114 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
packages/docs/src/pages/installation/usage/customization.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Code snippets used in the `Customization` component. | ||
// | ||
// Vite may confuse these examples with the legitimate code and try to compile | ||
// them, if they are in the component (.vue) file. | ||
|
||
export const sass = ` | ||
// Import Bulma's core | ||
@import "~bulma/sass/utilities/_all"; | ||
// Set your colors | ||
$primary: #8c67ef; | ||
$primary-light: findLightColor($primary); | ||
$primary-dark: findDarkColor($primary); | ||
$primary-invert: findColorInvert($primary); | ||
$twitter: #4099FF; | ||
$twitter-invert: findColorInvert($twitter); | ||
// Lists and maps | ||
$custom-colors: null !default; | ||
$custom-shades: null !default; | ||
// Setup $colors to use as bulma classes (e.g. 'is-twitter') | ||
$colors: mergeColorMaps( | ||
( | ||
"white": ( | ||
$white, | ||
$black, | ||
), | ||
"black": ( | ||
$black, | ||
$white, | ||
), | ||
"light": ( | ||
$light, | ||
$light-invert, | ||
), | ||
"dark": ( | ||
$dark, | ||
$dark-invert, | ||
), | ||
"primary": ( | ||
$primary, | ||
$primary-invert, | ||
$primary-light, | ||
$primary-dark, | ||
), | ||
"link": ( | ||
$link, | ||
$link-invert, | ||
$link-light, | ||
$link-dark, | ||
), | ||
"info": ( | ||
$info, | ||
$info-invert, | ||
$info-light, | ||
$info-dark, | ||
), | ||
"success": ( | ||
$success, | ||
$success-invert, | ||
$success-light, | ||
$success-dark, | ||
), | ||
"warning": ( | ||
$warning, | ||
$warning-invert, | ||
$warning-light, | ||
$warning-dark, | ||
), | ||
"danger": ( | ||
$danger, | ||
$danger-invert, | ||
$danger-light, | ||
$danger-dark, | ||
), | ||
), | ||
$custom-colors | ||
); | ||
// Links | ||
$link: $primary; | ||
$link-invert: $primary-invert; | ||
$link-focus-border: $primary; | ||
// Import Bulma and Buefy styles | ||
@import "~bulma"; | ||
@import "~buefy/src/scss/buefy"; | ||
` | ||
|
||
export const importing = ` | ||
import Vue from 'vue' | ||
import Buefy from 'buefy' | ||
Vue.use(Buefy)` |