-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Make the sandbox (npm run dev) switchable between LTR and RTL
- Use postcss-rtlcss to make styles bidirectional in serve mode. This produces styles like [dir='ltr'] {...} [dir='rtl'] {...} - (In build mode, continue to use rtlcss to build two separate style files, one for LTR and one for RTL) - Add a direction switcher to the sandbox - Move Sandbox.vue into a new src/demo directory, so we can put DirectionSwitcher.vue alongside it Unfortunately this uses two different RTL flipping packages for build vs serve mode. Thankfully postcss-rtlcss uses rtlcss for its flipping logic, so while this makes me a little uneasy we shouldn't see any differences in behavior between the two. Bug: T295189 Bug: T296031 Change-Id: Ie3221fb349b269eb259f07c530b2dbfb9ae44a1b
- Loading branch information
Showing
7 changed files
with
137 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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,39 @@ | ||
<template> | ||
<cdx-button | ||
v-for="direction in directions" | ||
:key="direction.value" | ||
type="primary" | ||
:action="modelValue === direction.value ? 'progressive' : 'default'" | ||
@click="$emit( 'update:modelValue', direction.value )" | ||
> | ||
{{ direction.label }} | ||
</cdx-button> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, PropType } from 'vue'; | ||
import CdxButton from '../components/button/Button.vue'; | ||
import { HTMLDirection } from '../types'; | ||
// TODO this component will be superfluous once we have a ButtonGroup component | ||
export default defineComponent( { | ||
components: { | ||
CdxButton | ||
}, | ||
props: { | ||
modelValue: { | ||
type: String as PropType<HTMLDirection>, | ||
default: 'ltr' | ||
} | ||
}, | ||
emits: [ | ||
'update:modelValue' | ||
], | ||
data: () => ( { | ||
directions: [ | ||
{ value: 'ltr', label: 'LTR' }, | ||
{ value: 'rtl', label: 'RTL' } | ||
] | ||
} ) | ||
} ); | ||
</script> |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { createApp } from 'vue'; | ||
import App from './Sandbox.vue'; | ||
import App from './demo/Sandbox.vue'; | ||
|
||
createApp( App ).mount( '#app' ); |
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