From b24c273babc494bcd42bd795c11db15983af4d3d Mon Sep 17 00:00:00 2001 From: Mikhail Lukin Date: Mon, 2 Sep 2024 13:41:03 +0700 Subject: [PATCH] feat(universal-date-input): improve after code review --- .changeset/loud-plants-judge.md | 1 + packages/themes/src/mixins/corp.css | 2 ++ packages/themes/src/mixins/universal-date-input/corp.css | 4 ++++ .../src/components/date-input/Component.tsx | 2 ++ .../components/date-input/date-input.desktop.module.css | 5 +++++ packages/universal-date-input/src/index.module.css | 6 +----- packages/universal-date-input/src/vars.css | 8 ++++++++ 7 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 packages/themes/src/mixins/universal-date-input/corp.css create mode 100644 packages/universal-date-input/src/components/date-input/date-input.desktop.module.css create mode 100644 packages/universal-date-input/src/vars.css diff --git a/.changeset/loud-plants-judge.md b/.changeset/loud-plants-judge.md index 15eaaa9911..c303ef1a59 100644 --- a/.changeset/loud-plants-judge.md +++ b/.changeset/loud-plants-judge.md @@ -17,6 +17,7 @@ '@alfalab/core-components-select': minor '@alfalab/core-components-side-panel': minor '@alfalab/core-components-themes': minor +'@alfalab/core-components-universal-date-input': minor --- Обновление темы corp diff --git a/packages/themes/src/mixins/corp.css b/packages/themes/src/mixins/corp.css index f86512c4e3..46812c7f39 100644 --- a/packages/themes/src/mixins/corp.css +++ b/packages/themes/src/mixins/corp.css @@ -5,6 +5,7 @@ @import './icon-button/corp.css'; @import './select/corp.css'; @import './tag/corp.css'; +@import './universal-date-input/corp.css'; @define-mixin theme-corp { @mixin button-corp; @@ -14,4 +15,5 @@ @mixin icon-button-corp; @mixin select-corp; @mixin tag-corp; + @mixin universal-date-input-corp; } diff --git a/packages/themes/src/mixins/universal-date-input/corp.css b/packages/themes/src/mixins/universal-date-input/corp.css new file mode 100644 index 0000000000..a3c4cf8207 --- /dev/null +++ b/packages/themes/src/mixins/universal-date-input/corp.css @@ -0,0 +1,4 @@ +@define-mixin universal-date-input-corp { + /* border */ + --calendar-popover-border-radius: var(--border-radius-12); +} diff --git a/packages/universal-date-input/src/components/date-input/Component.tsx b/packages/universal-date-input/src/components/date-input/Component.tsx index f763b9f330..73f17b0d19 100644 --- a/packages/universal-date-input/src/components/date-input/Component.tsx +++ b/packages/universal-date-input/src/components/date-input/Component.tsx @@ -27,6 +27,7 @@ import { } from '../../utils'; import styles from '../../index.module.css'; +import desktopStyles from './date-input.desktop.module.css'; function getDefaultValue(defaultValue?: Date | number | string, withTime?: boolean) { if (defaultValue !== undefined) { @@ -255,6 +256,7 @@ export const DateInput = forwardRef( popperClassName={cn( styles.calendarContainer, popoverProps?.popperClassName, + desktopStyles.calendarContainer, )} withTransition={false} > diff --git a/packages/universal-date-input/src/components/date-input/date-input.desktop.module.css b/packages/universal-date-input/src/components/date-input/date-input.desktop.module.css new file mode 100644 index 0000000000..fa8ecd2ee1 --- /dev/null +++ b/packages/universal-date-input/src/components/date-input/date-input.desktop.module.css @@ -0,0 +1,5 @@ +@import '../../vars.css'; + +.calendarContainer { + border-radius: var(--calendar-popover-border-radius); +} diff --git a/packages/universal-date-input/src/index.module.css b/packages/universal-date-input/src/index.module.css index 08d8142555..d552c8b72b 100644 --- a/packages/universal-date-input/src/index.module.css +++ b/packages/universal-date-input/src/index.module.css @@ -1,10 +1,6 @@ @import '../../themes/src/default.css'; @import '../../calendar/src/vars.css'; - -:root { - --calendar-icon-color: var(--color-light-neutral-translucent-700); - --calendar-popover-border-radius: var(--border-radius-m); -} +@import './vars.css'; .wrapper { display: inline-block; diff --git a/packages/universal-date-input/src/vars.css b/packages/universal-date-input/src/vars.css new file mode 100644 index 0000000000..9328744ca7 --- /dev/null +++ b/packages/universal-date-input/src/vars.css @@ -0,0 +1,8 @@ +@import '../../themes/src/default.css'; + +:root { + --calendar-icon-color: var(--color-light-neutral-translucent-700); + + /* border */ + --calendar-popover-border-radius: var(--border-radius-8); +}