diff --git a/packages/theme/src/Theme.svelte b/packages/theme/src/Theme.svelte index f79b909b99..936823c0a7 100644 --- a/packages/theme/src/Theme.svelte +++ b/packages/theme/src/Theme.svelte @@ -22,10 +22,10 @@ const currentFontSize = getCurrnetFontSize() const setRootColors = (theme: string) => { - document.body.setAttribute('class', `${theme} ${getCurrnetFontSize()}`) + document.documentElement.setAttribute('class', `${theme} ${getCurrnetFontSize()}`) } const setRootFontSize = (fontsize: string) => { - document.body.setAttribute('class', `${getCurrentTheme()} ${fontsize}`) + document.documentElement.setAttribute('class', `${getCurrentTheme()} ${fontsize}`) } setContext('theme', { diff --git a/packages/theme/styles/_layouts.scss b/packages/theme/styles/_layouts.scss new file mode 100644 index 0000000000..45d7134ae7 --- /dev/null +++ b/packages/theme/styles/_layouts.scss @@ -0,0 +1,93 @@ +// +// Copyright © 2021 Anticrm Platform Contributors. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/* CLEAR */ +button { + display: flex; + justify-content: center; + align-items: center; + padding: 0; + font-size: inherit; + background-color: transparent; + border: 1px solid transparent; + outline: none; + cursor: pointer; +} +audio, canvas, embed, iframe, img, object, svg, video { + display: block; + vertical-align: middle; +} +input:-webkit-autofill, +input:-webkit-autofill:hover, +input:-webkit-autofill:focus +input:-webkit-autofill, +textarea:-webkit-autofill, +textarea:-webkit-autofill:hover +textarea:-webkit-autofill:focus, +select:-webkit-autofill, +select:-webkit-autofill:hover, +select:-webkit-autofill:focus { + -webkit-text-fill-color: var(--theme-caption-color); + transition: background-color 5000s ease-in-out 0s; + background: transparent; +} + +/* Common */ +.flex { display: flex; } +.flex-center { + display: flex; + justify-content: center; + align-items: center; +} +.flex-between { + display: flex; + justify-content: space-between; + align-items: center; +} +.flex-row-center { + display: flex; + align-items: center; +} +.flex-row-reverse { + display: flex; + flex-direction: row-reverse; + align-items: center; +} +.flex-col { + display: flex; + flex-direction: column; +} +.flex-col-center { + display: flex; + flex-direction: column; + align-items: center; +} +.h-full { height: 100%; } +.square-36 { width: 2.25rem; height: 2.25rem; } + +/* Backgrounds & Colors */ +.background-theme-bg-color { background-color: var(--theme-bg-color); } +.background-highlight-red { background-color: var(--highlight-red); } +.background-button-bg-enabled { background-color: var(--theme-button-bg-enabled); } +.background-menu-divider { background-color: var(--theme-menu-divider); } +.background-primary-button-enabled { background-color: var(--primary-button-enabled); } + +.content-color { color: var(--theme-content-color); } +.content-trans-color { color: var(--theme-content-trans-color); } +.caption-color { color: var(--theme-caption-color); } + +.border-primary-button { border-color: var(--primary-button-border); } +.border-button-enabled { border: 1px solid var(--theme-button-border-enabled); } +.bottom-divider { border-bottom: 1px solid var(--theme-menu-divider); } diff --git a/packages/theme/styles/_tailwind.scss b/packages/theme/styles/_tailwind.scss new file mode 100644 index 0000000000..c571f37bea --- /dev/null +++ b/packages/theme/styles/_tailwind.scss @@ -0,0 +1,112 @@ +// +// Copyright © 2021 Anticrm Platform Contributors. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/* Position */ +.relative { position: relative; } +.absolute { position: absolute; } + +.top-3 { top: .75rem } +.right-3 { right: .75rem } + +/* Width & Height */ +.w-0 { width: 0; } +.w-2 { width: .5rem; } +.w-9 { width: 2.25rem; } +.w-10 { width: 2.5rem; } +.w-13 { width: 3.25rem; } // our +.w-20 { width: 5rem; } +.w-72 { width: 18rem; } +.w-full { width: 100%; } + +.h-0 { height: 0; } +.h-2 { height: .5rem; } +.h-9 { height: 2.25rem; } +.h-10 { height: 2.5rem; } +.h-12 { height: 3rem; } +.h-13 { height: 3.25rem; } // our +.h-18 { height: 4.5rem; } // our +.h-auto { height: auto; } +.h-px { height: 1px; } +.h-screen { height: 100vh; } + +/* Spacing */ +.mr-2 { margin-right: .5rem; } +.mb-2 { margin-bottom: .5rem; } +.mx-3 { margin-left: .75rem; margin-right: .75rem; } +.mr-3 { margin-right: .75rem; } +.mx-4 { margin-left: 1rem; margin-right: 1rem; } +.mr-4 { margin-right: 1rem; } +.my-5 { margin-top: 1.25rem; margin-bottom: 1.25rem; } +.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; } +.mb-10 { margin-bottom: 2.5rem; } +.mx-10 { margin-left: 2.5rem; margin-right: 2.5rem; } +.ml-11 { margin-left: 2.75rem; } + +.p-0 { padding: 0; } +.pb-5 { padding-bottom: 1.25rem; } +.pr-8 { padding-right: 2rem; } +.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; } +.px-7 { padding-left: 1.75rem; padding-right: 1.75rem; } +.pl-10 { padding-left: 2.5rem; } + +/* Flex */ +.flex { display: flex; } +.flex-col { flex-direction: column; } +.flex-row-reverse { flex-direction: row-reverse; } +.justify-center { justify-content: center; } +.justify-between { justify-content: space-between; } +.items-center { align-items: center; } +.flex-grow { flex-grow: 1; } + +/* Grid */ +.grid { display: grid; } +.grid-flow-col { grid-auto-flow: column; } +.auto-cols-min { grid-auto-columns: min-content; } +.gap-3 { gap: .75rem; } + +/* Typography */ +.text-xs { font-size: .75rem; } +.text-sm { font-size: .875rem; } +.text-base { font-size: 1rem; } +.font-medium { font-weight: 500; } +.font-semibold { font-weight: 600; } +.text-center { text-align: center; } +.whitespace-nowrap { white-space: nowrap; } +.overflow-ellipsis { text-overflow: ellipsis; } + +/* Borders */ +.rounded { border-radius: .25rem; } +.rounded-lg { border-radius: .5rem; } +.rounded-xl { border-radius: .75rem; } +.rounded-3xl { border-radius: 1.5rem; } +.rounded-full { border-radius: 100%; } +.border { border-width: 1px; } +.border-solid { border-style: solid; } +.border-transparent { border-color: transparent; } +.outline-none { outline: none; } + +/* Backgrounds & Colors */ +.bg-transparent { background-color: transparent; } +.opacity-30 { opacity: .3; } +.opacity-60 { opacity: .6; } + +/* Others */ +.border-box { box-sizing: border-box; } +.cursor-pointer { cursor: pointer; } +.cursor-default { cursor: default; } +.overflow-hidden { overflow: hidden; } +.select-none { user-select: none; } +.visible { visibility: visible; } +.invisible { visibility: hidden; } diff --git a/packages/theme/styles/global.scss b/packages/theme/styles/global.scss index d3ed702e11..f2df36063a 100644 --- a/packages/theme/styles/global.scss +++ b/packages/theme/styles/global.scss @@ -14,6 +14,8 @@ // @import "./_colors.scss"; +@import "./_tailwind.scss"; +@import "./_layouts.scss"; @font-face { font-family: 'IBM Plex Sans'; @@ -81,13 +83,8 @@ border-radius: 4px; } -.small-font { - font-size: 12px; -} - -.normal-font { - font-size: 14px; -} +.normal-font { font-size: 16px; } +.small-font { font-size: 14px; } body { -webkit-font-smoothing: antialiased; @@ -95,8 +92,8 @@ body { text-rendering: optimizeLegibility; font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto; - font-size: 14px; font-weight: 400; + font-size: .875rem; color: var(--theme-content-color); background-color: var(--theme-menu-color); } diff --git a/packages/ui/src/components/ActionIcon.svelte b/packages/ui/src/components/ActionIcon.svelte index e491f254d6..25ba86e30e 100644 --- a/packages/ui/src/components/ActionIcon.svelte +++ b/packages/ui/src/components/ActionIcon.svelte @@ -42,16 +42,7 @@ +} + \ No newline at end of file diff --git a/packages/ui/src/components/Tooltip.svelte b/packages/ui/src/components/Tooltip.svelte index aae7b2a60c..b5d256324a 100644 --- a/packages/ui/src/components/Tooltip.svelte +++ b/packages/ui/src/components/Tooltip.svelte @@ -21,7 +21,7 @@ export let direction: string = 'top' -