reuse scss variables in js for SSOT (#2867)

This commit is contained in:
David Luzar 2021-01-28 12:58:35 +01:00 committed by GitHub
parent 978e85a33b
commit d4e12a2962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 24 additions and 22 deletions

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.Avatar { .Avatar {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.CollabButton.is-collaborating { .CollabButton.is-collaborating {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.color-picker { .color-picker {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.context-menu { .context-menu {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.Dialog { .Dialog {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.ExportDialog__preview { .ExportDialog__preview {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.HelpDialog h3 { .HelpDialog h3 {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
// this is loosely based on the longest hint text // this is loosely based on the longest hint text
$wide-viewport-width: 1000px; $wide-viewport-width: 1000px;

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.picker-container { .picker-container {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.Modal { .Modal {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.PasteChartDialog { .PasteChartDialog {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.Stats { .Stats {
position: fixed; position: fixed;

View File

@ -1,4 +1,4 @@
@import "../css/_variables.scss"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.TextInput { .TextInput {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.Toast { .Toast {

View File

@ -1,5 +1,5 @@
@import "open-color/open-color.scss"; @import "open-color/open-color.scss";
@import "../css/variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.ToolIcon { .ToolIcon {

View File

@ -1,4 +1,4 @@
@import "../css/_variables"; @import "../css/variables.module";
.excalidraw { .excalidraw {
.Tooltip { .Tooltip {
position: relative; position: relative;

View File

@ -1,4 +1,4 @@
@import "./_variables"; @import "./variables.module";
@import "./theme"; @import "./theme";
.excalidraw { .excalidraw {

View File

@ -2,3 +2,7 @@
// keep up to date with is-mobile.tsx // keep up to date with is-mobile.tsx
$is-mobile-query: "(max-width: 600px), (max-height: 500px) and (max-width: 1000px)"; $is-mobile-query: "(max-width: 600px), (max-height: 500px) and (max-width: 1000px)";
:export {
isMobileQuery: unquote($is-mobile-query);
}

View File

@ -1,4 +1,4 @@
@import "../../css/_variables"; @import "../../css/variables.module";
.excalidraw { .excalidraw {
.RoomDialog-linkContainer { .RoomDialog-linkContainer {

View File

@ -1,4 +1,5 @@
import React, { useState, useEffect, useRef, useContext } from "react"; import React, { useState, useEffect, useRef, useContext } from "react";
import variables from "./css/variables.module.scss";
const context = React.createContext(false); const context = React.createContext(false);
@ -10,10 +11,7 @@ export const IsMobileProvider = ({
const query = useRef<MediaQueryList>(); const query = useRef<MediaQueryList>();
if (!query.current) { if (!query.current) {
query.current = window.matchMedia query.current = window.matchMedia
? window.matchMedia( ? window.matchMedia(variables.isMobileQuery)
// keep up to date with _variables.scss
"(max-width: 600px), (max-height: 500px) and (max-width: 1000px)",
)
: (({ : (({
matches: false, matches: false,
addListener: () => {}, addListener: () => {},