Skip to content

Commit

Permalink
feat: обновлённая темизация иконок в инпутах
Browse files Browse the repository at this point in the history
  • Loading branch information
SiebenSieben committed Oct 15, 2021
2 parents eb24e2c + 529e840 commit ab90d60
Show file tree
Hide file tree
Showing 15 changed files with 154 additions and 35 deletions.
4 changes: 3 additions & 1 deletion packages/calendar-input/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import {
dateInLimits,
} from '@alfalab/core-components-calendar';

import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';

import styles from './index.module.css';

export type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
Expand Down Expand Up @@ -339,7 +341,7 @@ export const CalendarInput = forwardRef<HTMLInputElement, CalendarInputProps>(
disabled={disabled}
readOnly={readOnly}
mobileMode={mobileMode === 'native' ? 'native' : 'input'}
rightAddons={<span className={styles.calendarIcon} />}
rightAddons={<CalendarMIcon className={styles.calendarIcon} />}
onKeyDown={handleInputKeyDown}
onChange={handleInputChange}
block={true}
Expand Down
19 changes: 17 additions & 2 deletions packages/calendar-input/src/__snapshots__/Component.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,24 @@ exports[`CalendarInput Display tests should match snapshot 1`] = `
<div
class="addons rightAddons"
>
<span
<svg
class="calendarIcon"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M9 12v2H7v-2h2zm0 6v-2H7v2h2zm2-6h2v2h-2v-2zm2 4h-2v2h2v-2zm4-4v2h-2v-2h2z"
/>
<path
clip-rule="evenodd"
d="M6 2h2v2h8V2h2v2h3v16a3 3 0 01-3 3H6a3 3 0 01-3-3V4h3V2zm13 7H5v11a1 1 0 001 1h12a1 1 0 001-1V9z"
fill-rule="evenodd"
/>
</svg>
</div>
</div>
</div>
Expand Down
6 changes: 2 additions & 4 deletions packages/calendar-input/src/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import '../../calendar/src/vars.css';

:root {
--calendar-input-calendar-icon: url('https://alfabank.st/icons/glyph_calendar_m_primary.svg');
--calendar-input-icon-color: var(--color-light-graphic-primary);
--calendar-input-popover-border-color: var(--color-light-border-primary);
--calendar-input-popover-border-radius: var(--border-radius-m);
}
Expand All @@ -29,9 +29,7 @@
width: 24px;
height: 24px;
display: block;
background: var(--calendar-input-calendar-icon);
background-size: cover;
background-position: center;
color: var(--calendar-input-icon-color);

&:not(:only-child) {
margin-right: var(--gap-2xs);
Expand Down
38 changes: 34 additions & 4 deletions packages/calendar-range/src/__snapshots__/Component.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,24 @@ exports[`CalendarRange Display tests should match snapshot 1`] = `
<div
class="addons rightAddons"
>
<span
<svg
class="calendarIcon"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M9 12v2H7v-2h2zm0 6v-2H7v2h2zm2-6h2v2h-2v-2zm2 4h-2v2h2v-2zm4-4v2h-2v-2h2z"
/>
<path
clip-rule="evenodd"
d="M6 2h2v2h8V2h2v2h3v16a3 3 0 01-3 3H6a3 3 0 01-3-3V4h3V2zm13 7H5v11a1 1 0 001 1h12a1 1 0 001-1V9z"
fill-rule="evenodd"
/>
</svg>
</div>
</div>
</div>
Expand Down Expand Up @@ -591,9 +606,24 @@ exports[`CalendarRange Display tests should match snapshot 1`] = `
<div
class="addons rightAddons"
>
<span
<svg
class="calendarIcon"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M9 12v2H7v-2h2zm0 6v-2H7v2h2zm2-6h2v2h-2v-2zm2 4h-2v2h2v-2zm4-4v2h-2v-2h2z"
/>
<path
clip-rule="evenodd"
d="M6 2h2v2h8V2h2v2h3v16a3 3 0 01-3 3H6a3 3 0 01-3-3V4h3V2zm13 7H5v11a1 1 0 001 1h12a1 1 0 001-1V9z"
fill-rule="evenodd"
/>
</svg>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,19 @@ exports[`IntlPhoneInput should match snapshot 1`] = `
class="flagIcon m ru"
/>
</span>
<span
<svg
class="arrow"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M12 14L6.5 8.5 5 10l7 7 7-7-1.5-1.5L12 14z"
/>
</svg>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,19 @@ exports[`SelectWithTags Display tests should match snapshot 1`] = `
<div
class="addons rightAddons addons addons-size-xl"
>
<span
<svg
class="arrow"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M12 14L6.5 8.5 5 10l7 7 7-7-1.5-1.5L12 14z"
/>
</svg>
</div>
</div>
</div>
Expand Down Expand Up @@ -182,9 +192,19 @@ exports[`SelectWithTags Display tests should match snapshot with selected tags 1
<div
class="addons rightAddons addons addons-size-xl"
>
<span
<svg
class="arrow"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M12 14L6.5 8.5 5 10l7 7 7-7-1.5-1.5L12 14z"
/>
</svg>
</div>
</div>
</div>
Expand Down
56 changes: 48 additions & 8 deletions packages/select/src/__snapshots__/Component.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,19 @@ Object {
<div
class="addons rightAddons"
>
<span
<svg
class="arrow arrow"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M12 14L6.5 8.5 5 10l7 7 7-7-1.5-1.5L12 14z"
/>
</svg>
</div>
</div>
</div>
Expand Down Expand Up @@ -87,9 +97,19 @@ Object {
<div
class="addons rightAddons"
>
<span
<svg
class="arrow arrow"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M12 14L6.5 8.5 5 10l7 7 7-7-1.5-1.5L12 14z"
/>
</svg>
</div>
</div>
</div>
Expand Down Expand Up @@ -186,9 +206,19 @@ exports[`Select Snapshots tests should match snapshot with fatal error 1`] = `
<div
class="addons rightAddons"
>
<span
<svg
class="arrow arrow"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M12 14L6.5 8.5 5 10l7 7 7-7-1.5-1.5L12 14z"
/>
</svg>
</div>
</div>
<span
Expand Down Expand Up @@ -240,9 +270,19 @@ exports[`Select Snapshots tests should match snapshot with visibleOptions 1`] =
<div
class="addons rightAddons"
>
<span
<svg
class="arrow arrow open"
/>
fill="currentColor"
focusable="false"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
>
<path
d="M12 14L6.5 8.5 5 10l7 7 7-7-1.5-1.5L12 14z"
/>
</svg>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/select/src/components/arrow/Component.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import cn from 'classnames';
import { ChevronDownMIcon } from '@alfalab/icons-glyph/ChevronDownMIcon';
import { ArrowProps } from '../../typings';

import styles from './index.module.css';

export const Arrow = ({ open, className }: ArrowProps) => (
<span className={cn(styles.arrow, className, { [styles.open]: open })} />
<ChevronDownMIcon className={cn(styles.arrow, className, { [styles.open]: open })} />
);
4 changes: 1 addition & 3 deletions packages/select/src/components/arrow/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
display: block;
width: 24px;
height: 24px;
color: var(--select-arrow-color);

background: var(--select-arrow-background);
background-size: cover;
background-position: center;
transition: transform 0.15s ease-in-out, opacity 0.2s ease;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/select/src/vars.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:root {
--select-error-color: var(--color-light-text-negative);
--select-arrow-background: url('https://alfabank.st/icons/glyph_chevron-down_m.svg');
--select-arrow-color: var(--color-light-graphic-primary);
--select-arrow-hover-opacity: 0.7;

/* options list */
Expand Down
3 changes: 3 additions & 0 deletions packages/themes/src/mixins/calendar-input/corp.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@define-mixin calendar-input-corp {
--calendar-input-icon-color: var(--color-light-graphic-secondary);
}
3 changes: 0 additions & 3 deletions packages/themes/src/mixins/calendar-input/mobile.css

This file was deleted.

4 changes: 4 additions & 0 deletions packages/themes/src/mixins/corp.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
@import './button/corp.css';
@import './input/corp.css';
@import './tabs/corp.css';
@import './calendar-input/corp.css';
@import './select/corp.css';

@define-mixin theme-corp {
@mixin button-corp;
@mixin input-corp;
@mixin tabs-corp;
@mixin calendar-input-corp;
@mixin select-corp;
}
2 changes: 0 additions & 2 deletions packages/themes/src/mixins/mobile.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
@import './radio/mobile.css';
@import './confirmation/mobile.css';
@import './input/mobile.css';
@import './calendar-input/mobile.css';
@import './slider/mobile.css';
@import './slider-input/mobile.css';

Expand All @@ -17,7 +16,6 @@
@mixin radio-mobile;
@mixin confirmation-mobile;
@mixin input-mobile;
@mixin calendar-input-mobile;
@mixin form-control-mobile;
@mixin input-mobile;
@mixin slider-mobile;
Expand Down
3 changes: 3 additions & 0 deletions packages/themes/src/mixins/select/corp.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@define-mixin select-corp {
--select-arrow-color: var(--color-light-graphic-secondary);
}

0 comments on commit ab90d60

Please sign in to comment.