diff --git a/.changeset/rare-donuts-vanish.md b/.changeset/rare-donuts-vanish.md new file mode 100644 index 0000000000..0f2a3e9867 --- /dev/null +++ b/.changeset/rare-donuts-vanish.md @@ -0,0 +1,5 @@ +--- +'@alfalab/core-components-button': patch +--- + + - Вынос общих стилей цветов button/base-button diff --git a/.github/workflows/package-size.yml b/.github/workflows/package-size.yml index 16557e314d..938a32d98c 100644 --- a/.github/workflows/package-size.yml +++ b/.github/workflows/package-size.yml @@ -51,7 +51,7 @@ jobs: const now = currentFile[packageName]?.[entryPoint] || 0; const before = masterFile[packageName]?.[entryPoint] || 0; - if (Math.abs(now - before) > 2) { + if (Math.abs(now - before) > 0) { shouldComment = true; acc += `| ${packageName}/${entryPoint} | ${now} ${ now - before > 0 ? `(+${(now - before).toFixed(2)} KB🔺)` : `(-${(before - now).toFixed(2)} KB)` diff --git a/packages/button/src/components/base-button/Component.tsx b/packages/button/src/components/base-button/Component.tsx index c5b2f533d5..93c4e54ed1 100644 --- a/packages/button/src/components/base-button/Component.tsx +++ b/packages/button/src/components/base-button/Component.tsx @@ -15,9 +15,9 @@ import { useFocus } from '@alfalab/hooks'; import { CommonButtonProps, ComponentProps, PrivateButtonProps } from '../../typings'; -import defaultColors from './default.module.css'; +import defaultColors from './colors.default.module.css'; +import invertedColors from './colors.inverted.module.css'; import commonStyles from './index.module.css'; -import invertedColors from './inverted.module.css'; const colorStyles = { default: defaultColors, diff --git a/packages/button/src/components/base-button/colors.common.module.css b/packages/button/src/components/base-button/colors.common.module.css new file mode 100644 index 0000000000..0dd37f480c --- /dev/null +++ b/packages/button/src/components/base-button/colors.common.module.css @@ -0,0 +1,43 @@ +@import '../../vars.css'; + +.accent { + border: 1px solid transparent; +} + +.primary { + border: 1px solid transparent; +} + +.filled { + border: 1px solid transparent; +} + +.transparent { + background-color: transparent; + border: 1px solid transparent; +} + +.link { + background-color: transparent; + border: 1px solid transparent; +} + +.text { + background-color: transparent; +} + +.ghost { + background-color: transparent; +} + +/* Disabled */ + +.component[disabled] { + &.transparent { + background-color: transparent; + } + + &.link { + background-color: transparent; + } +} diff --git a/packages/button/src/components/base-button/default.module.css b/packages/button/src/components/base-button/colors.default.module.css similarity index 93% rename from packages/button/src/components/base-button/default.module.css rename to packages/button/src/components/base-button/colors.default.module.css index c639f2c320..a19d00af4b 100644 --- a/packages/button/src/components/base-button/default.module.css +++ b/packages/button/src/components/base-button/colors.default.module.css @@ -1,9 +1,9 @@ @import '../../vars.css'; +@import './colors.common.module.css'; .accent { color: var(--button-accent-color); background-color: var(--button-accent-base-bg-color); - border: 1px solid transparent; @media (hover: hover) { &:hover { @@ -21,8 +21,6 @@ } .primary { - border: 1px solid transparent; - & .hint { color: var(--button-primary-hint-color); } @@ -94,7 +92,6 @@ .filled { color: var(--color-light-text-primary); background-color: var(--color-light-neutral-translucent-300); - border: 1px solid transparent; @media (hover: hover) { &:hover { @@ -113,8 +110,6 @@ .transparent { color: var(--button-transparent-base-color); - background-color: transparent; - border: 1px solid transparent; @media (hover: hover) { &:hover { @@ -137,8 +132,6 @@ .link { color: var(--button-link-base-color); - background-color: transparent; - border: 1px solid transparent; @media (hover: hover) { &:hover { @@ -156,7 +149,6 @@ } .text { - background-color: transparent; color: var(--button-text-base-color); @media (hover: hover) { @@ -175,7 +167,6 @@ } .ghost { - background-color: transparent; color: var(--button-ghost-base-color); @media (hover: hover) { @@ -240,16 +231,12 @@ } &.transparent { - background-color: transparent; - &.loading { color: var(--button-transparent-base-color); } } &.link { - background-color: transparent; - &.loading { color: var(--button-link-base-color); } diff --git a/packages/button/src/components/base-button/inverted.module.css b/packages/button/src/components/base-button/colors.inverted.module.css similarity index 93% rename from packages/button/src/components/base-button/inverted.module.css rename to packages/button/src/components/base-button/colors.inverted.module.css index 46d41dc71e..a80ffe1e93 100644 --- a/packages/button/src/components/base-button/inverted.module.css +++ b/packages/button/src/components/base-button/colors.inverted.module.css @@ -1,9 +1,9 @@ @import '../../vars.css'; +@import './colors.common.module.css'; .accent { color: var(--button-inverted-accent-color); background-color: var(--button-inverted-accent-base-bg-color); - border: 1px solid transparent; @media (hover: hover) { &:hover { @@ -21,8 +21,6 @@ } .primary { - border: 1px solid transparent; - & .hint { color: var(--button-inverted-primary-hint-color); } @@ -94,7 +92,6 @@ .filled { color: var(--color-light-text-primary-inverted); background-color: var(--color-light-neutral-translucent-300-inverted); - border: 1px solid transparent; @media (hover: hover) { &:hover { @@ -113,8 +110,6 @@ .transparent { color: var(--button-inverted-transparent-base-color); - background-color: transparent; - border: 1px solid transparent; @media (hover: hover) { &:hover { @@ -137,8 +132,6 @@ .link { color: var(--button-inverted-link-base-color); - background-color: transparent; - border: 1px solid transparent; @media (hover: hover) { &:hover { @@ -157,7 +150,6 @@ } .text { - background-color: transparent; color: var(--button-inverted-text-base-color); @media (hover: hover) { @@ -176,7 +168,6 @@ } .ghost { - background-color: transparent; color: var(--button-inverted-ghost-base-color); @media (hover: hover) { @@ -190,6 +181,8 @@ } } +/* Disabled */ + .component[disabled] { &.accent { color: var(--button-inverted-accent-disabled-color); @@ -237,16 +230,12 @@ } &.transparent { - background-color: transparent; - &.loading { color: var(--button-inverted-transparent-base-color); } } &.link { - background-color: transparent; - &.loading { color: var(--button-inverted-link-base-color); }