Skip to content

Commit

Permalink
Use Codex tokens and custom spacing variables (#762)
Browse files Browse the repository at this point in the history
Migrate away from Wikit tokens to Codex SASS variables where
they are available. In some cases we use custom CSS variables
for values from Wikit whose Codex equivalents are missing.

Bug: T369510
Bug: T369508
Bug: T369509
  • Loading branch information
codders authored Oct 11, 2024
1 parent 0656354 commit 71a7cd5
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 41 deletions.
4 changes: 3 additions & 1 deletion src/components/AnonymousEditWarning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const warning = computed(
</template>

<style lang="scss" scoped>
@import '@/styles/custom-variables.css';
.wbl-snl-anonymous-edit-warning {
margin: 1rem 0;
margin: var( --dimension-layout-xsmall ) 0;
}
</style>
4 changes: 2 additions & 2 deletions src/components/LanguageInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ export default {
</template>

<style lang="scss">
@import '@wmde/wikit-tokens/variables';
@import '@wikimedia/codex-design-tokens/theme-wikimedia-ui';
/* stylelint-disable selector-class-pattern */
.wbl-snl-language-lookup .wikit .wikit-Lookup__label-wrapper {
gap: $dimension-spacing-xsmall;
gap: $spacing-50;
}
/* stylelint-enable selector-class-pattern */
Expand Down
8 changes: 0 additions & 8 deletions src/components/LemmaInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,3 @@ export default {
</template>
</cdx-field>
</template>

<style lang="scss">
@import '@wmde/wikit-tokens/variables';
.wbl-snl-required-asterisk {
margin-inline-start: $dimension-spacing-xsmall;
}
</style>
4 changes: 2 additions & 2 deletions src/components/LexicalCategoryInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export default {
</template>

<style lang="scss">
@import '@wmde/wikit-tokens/variables';
@import '@wikimedia/codex-design-tokens/theme-wikimedia-ui';
/* stylelint-disable selector-class-pattern */
.wbl-snl-lexical-category-lookup .wikit .wikit-Lookup__label-wrapper {
gap: $dimension-spacing-xsmall;
gap: $spacing-50;
}
/* stylelint-enable selector-class-pattern */
Expand Down
23 changes: 12 additions & 11 deletions src/components/NewLexemeForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,30 +191,31 @@ export default {
</template>

<style scoped lang="scss">
@import '@wmde/wikit-tokens/variables';
@import '@wmde/wikit-vue-components/src/styles/mixins/Typography';
@import '@/styles/custom-variables.css';
@import '@wikimedia/codex-design-tokens/theme-wikimedia-ui';
.wbl-snl-form {
& > * + * {
margin-top: $dimension-layout-xsmall;
margin-top: var( --dimension-layout-xsmall );
}
// Box model
padding: $dimension-layout-small;
padding: var( --dimension-layout-small );
// Border
border-style: $border-style-base;
border-width: $border-width-thin;
border-width: $border-width-base;
border-radius: $border-radius-base;
border-color: $border-color-base-subtle;
border-color: $border-color-muted;
}
.wbl-snl-copyright {
@include small-text;
font-size: 0.8125rem;
font-style: italic;
font-synthesis: none;
/* codex Body S */
font-family: $font-family-system-sans;
font-size: $font-size-small;
font-weight: $font-weight-normal;
line-height: $line-height-medium;
color: $color-base;
margin-bottom: 0;
}
Expand Down
14 changes: 4 additions & 10 deletions src/components/RequiredAsterisk.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,12 @@ export default {
</template>

<style lang="scss" scoped>
@import '@wmde/wikit-tokens/variables';
@import '../styles/custom-variables.css';
@import '@wikimedia/codex-design-tokens/theme-wikimedia-ui';
.wbl-snl-required-asterisk {
font-size: $font-size-xxlarge;
font-size: $font-size-x-large;
line-height: 0;
&:not( :first-child ) {
margin-inline-start: $dimension-spacing-small;
}
&:not( :last-child ) {
margin-inline-end: $dimension-spacing-small;
}
margin-inline-start: var( --dimension-spacing-xsmall );
}
</style>
16 changes: 11 additions & 5 deletions src/components/SearchExisting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ const searchMessage = computed( () => messages.get(
</template>

<style lang="scss" scoped>
@import '@wmde/wikit-tokens/variables';
@import '@wmde/wikit-vue-components/src/styles/mixins/Typography';
@import '@/styles/custom-variables.css';
@import '@wikimedia/codex-design-tokens/theme-wikimedia-ui';
.wbl-snl-search-existing {
@include body;
/* font Codex Body */
font-family: $font-family-system-sans;
font-size: $font-size-small;
font-weight: $font-weight-normal;
line-height: $line-height-medium;
color: $color-base;
margin-top: 1rem;
margin-bottom: 1rem;
/* margins */
margin-top: var( --dimension-layout-xsmall );
margin-bottom: var( --dimension-layout-xsmall );
}
</style>
9 changes: 7 additions & 2 deletions src/components/SpellingVariantInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,18 @@ export default {
</template>

<style lang="scss">
@import '@wmde/wikit-tokens/variables';
@import '@wikimedia/codex-design-tokens/theme-wikimedia-ui';
.wbl-snl-spelling-variant-lookup {
/* stylelint-disable plugin/stylelint-bem-namics, selector-class-pattern */
&.wikit .wikit-Lookup__label-wrapper {
gap: $dimension-spacing-xsmall;
gap: $spacing-50;
}
/* stylelint-enable plugin/stylelint-bem-namics, selector-class-pattern */
&__help-link {
padding-bottom: $spacing-50;
display: inline-block;
}
}
</style>
8 changes: 8 additions & 0 deletions src/styles/custom-variables.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* {
/* layout */
--dimension-layout-xsmall: 1rem;
--dimension-layout-small: 1.5rem;

/* spacing */
--dimension-spacing-xsmall: 0.25rem;
}

0 comments on commit 71a7cd5

Please sign in to comment.