From 43b6d64bfe6fbc244116cbbdeb5b72fc7abc7044 Mon Sep 17 00:00:00 2001 From: Avior Date: Mon, 10 Oct 2022 11:19:37 +0200 Subject: [PATCH] fix: Missing color on Popup Signed-off-by: Avior --- src/Button/Button.module.styl | 13 ++++++++----- src/Button/Button.stories.tsx | 4 ++-- src/Button/index.tsx | 4 +++- src/Input/Input.module.styl | 3 --- src/Menu/Menu.module.styl | 13 ++++++++++++- src/Menu/Menu.stories.tsx | 2 +- src/Menu/index.tsx | 4 ++-- src/Popup/Popup.module.styl | 4 ++-- src/Sidebar/Sidebar.module.styl | 5 +++++ src/Sidebar/index.tsx | 16 +++++++++++----- src/Table/Table.module.styl | 6 +++--- src/colors.styl | 2 +- src/config.styl | 17 ----------------- 13 files changed, 50 insertions(+), 43 deletions(-) diff --git a/src/Button/Button.module.styl b/src/Button/Button.module.styl index 97cf713..ede250e 100644 --- a/src/Button/Button.module.styl +++ b/src/Button/Button.module.styl @@ -68,6 +68,13 @@ margin 0 margin-top 8px + @media (max-width $mobile) + &.mobileBlock + display flex + width 100% + margin 0 + margin-top 8px + &.large padding 15px 30px font-size rem(20) @@ -87,15 +94,11 @@ &:disabled background nativeRGB(var(--gray-500)) - color nativeRGB(var(--gray-500)) + color nativeRGB(var(--gray-500--text)) transform none box-shadow none cursor initial - @media (prefers-color-scheme dark) - background $lightGrayDark - color $darkGrayDark - &.outline border 2px solid nativeRGB(var(--gray-500)) background transparent diff --git a/src/Button/Button.stories.tsx b/src/Button/Button.stories.tsx index b402b92..fc8a3c6 100644 --- a/src/Button/Button.stories.tsx +++ b/src/Button/Button.stories.tsx @@ -13,9 +13,9 @@ export const Button = (args: any) => Button Button diff --git a/src/Button/index.tsx b/src/Button/index.tsx index 33711f6..5da2139 100644 --- a/src/Button/index.tsx +++ b/src/Button/index.tsx @@ -19,6 +19,7 @@ interface Props { block?: boolean href?: string as?: string + mobileBlock?: boolean disabled?: boolean loading?: boolean onClick?: (event: React.MouseEvent) => void @@ -57,7 +58,8 @@ export default class Button extends React.Component { [css.block, this.props.block], [css[this.props.size as string], this.props.size], [css.nomargintop, this.props.nomargintop], - [css.loading, this.props.loading] + [css.loading, this.props.loading], + [css.mobileBlock, this.props.mobileBlock] ) if (this.props.href && !this.props.disabled) { diff --git a/src/Input/Input.module.styl b/src/Input/Input.module.styl index a13b6e0..b0a6219 100644 --- a/src/Input/Input.module.styl +++ b/src/Input/Input.module.styl @@ -115,9 +115,6 @@ font-size rem(16) transition color $transition opacity 1 - // color $darkGrayLight - // @media (prefers-color-scheme dark) - // color $darkGrayDark color black @media (prefers-color-scheme dark) diff --git a/src/Menu/Menu.module.styl b/src/Menu/Menu.module.styl index 6149668..3197831 100644 --- a/src/Menu/Menu.module.styl +++ b/src/Menu/Menu.module.styl @@ -13,10 +13,12 @@ li svg margin-right 8px + vertical-align sub &:last-child margin 0 - display inline-flex padding 8px + &.link + padding 0 overflow-x hidden text-overflow: ellipsis; margin-bottom 8px @@ -37,3 +39,12 @@ &:active background nativeRGB(var(--theme-500)) color white + +.link + padding 0 +.linkInternal + padding 8px + display inline-block + width 100% +.icon + vertical-align sub diff --git a/src/Menu/Menu.stories.tsx b/src/Menu/Menu.stories.tsx index e8c4a94..2cd5247 100644 --- a/src/Menu/Menu.stories.tsx +++ b/src/Menu/Menu.stories.tsx @@ -10,7 +10,7 @@ export default { const list: Component['props']['items'] = [ {value: 'Menu item 1'}, - {value: 'Menu item 2', icon: XOctagon}, + {value: 'Menu with link', icon: XOctagon, href: '/'}, {value: 'Menu item 3', icon: XOctagon}, {value: 'Menu item 4', icon: XOctagon}, {value: 'Menu item 5', selected: true, icon: XOctagon}, diff --git a/src/Menu/index.tsx b/src/Menu/index.tsx index 3f5ee11..64ce1cb 100644 --- a/src/Menu/index.tsx +++ b/src/Menu/index.tsx @@ -29,8 +29,8 @@ export default class Menu extends React.Component { ) if (item.href) { return ( -
  • - {content} +
  • + {content}
  • ) } diff --git a/src/Popup/Popup.module.styl b/src/Popup/Popup.module.styl index aa16dd4..8aa3208 100644 --- a/src/Popup/Popup.module.styl +++ b/src/Popup/Popup.module.styl @@ -7,9 +7,9 @@ top 0 margin 0 !important // sorry :( left 0 - background nativeRGBA($lightGrayLight, .7) + background nativeRGBA(var(--gray-100), .7) @media (prefers-color-scheme dark) - background nativeRGBA($lightGrayDark, .7) + background nativeRGBA(var(--gray-500), .7) cursor pointer z-index 200 animation fadeIn .3s ease-in-out 1 forwards diff --git a/src/Sidebar/Sidebar.module.styl b/src/Sidebar/Sidebar.module.styl index c9d2585..98913cb 100644 --- a/src/Sidebar/Sidebar.module.styl +++ b/src/Sidebar/Sidebar.module.styl @@ -167,6 +167,11 @@ display flex //max-height 24px + &.link + padding 0 + a + padding 8px + &.active > div color white background nativeRGB(var(--theme-500)) diff --git a/src/Sidebar/index.tsx b/src/Sidebar/index.tsx index 1d93df0..9e9e711 100644 --- a/src/Sidebar/index.tsx +++ b/src/Sidebar/index.tsx @@ -223,11 +223,17 @@ export default class Sidebar extends React.Component { ) const isActive = this.state.path === obj.path || obj.subMenu?.find((it) => this.state.path === it.path) - return
  • -
    + return
  • +
    {obj.path ? ( {content} diff --git a/src/Table/Table.module.styl b/src/Table/Table.module.styl index e3060ed..c58d97d 100644 --- a/src/Table/Table.module.styl +++ b/src/Table/Table.module.styl @@ -5,13 +5,13 @@ width 100% tr:not(:last-child) td - border-bottom 1px solid $darkGrayLight + border-bottom 1px solid nativeRGB(var(--gray-600)) tr th - border-bottom 2px solid $darkGrayLight + border-bottom 2px solid nativeRGB(var(--gray-600)) tr td:not(:first-child) tr th:not(:first-child) - border-left 1px solid $darkGrayLight + border-left 1px solid nativeRGB(var(--gray-600)) th font-weight bold diff --git a/src/colors.styl b/src/colors.styl index b6b92a9..f393951 100644 --- a/src/colors.styl +++ b/src/colors.styl @@ -13,7 +13,7 @@ generateTheme($name, c50, c100, c200, c300, c400, c500, c600, c700, c800, c900) {"--" + $name + "-700"}: hextorgb(c700) {"--" + $name + "-800"}: hextorgb(c800) {"--" + $name + "-900"}: hextorgb(c900) - {"--" + $name + "-50-text"}: light(c50 ) ? black : white + {"--" + $name + "-50-text"}: light(c50) ? black : white {"--" + $name + "-100-text"}: light(c100) ? black : white {"--" + $name + "-200-text"}: light(c200) ? black : white {"--" + $name + "-300-text"}: light(c300) ? black : white diff --git a/src/config.styl b/src/config.styl index 0391131..df9cb84 100644 --- a/src/config.styl +++ b/src/config.styl @@ -4,23 +4,6 @@ nativeRGBA(color, opacity) nativeRGB(color) unquote('rgb(') color unquote(');') -// @deprecated -$main = nativeRGB(var(--theme-500)) -$textOnMain = white - -$backgroundDark = nativeRGB(var(--gray-900)) -$backgroundLight = nativeRGB(var(--gray-50)) -$foregroundDark = nativeRGB(var(--gray-800)) -$foregroundLight = nativeRGB(var(--theme-50)) - -// Light theme grays -$darkGrayLight = #777 -$lightGrayLight = #F4F4F4 - -// Dark theme grays -$darkGrayDark = #444 -$lightGrayDark = #AAA -// -@deprecated $transitionTime = .15s $transitionFunction = ease-in-out