Skip to content

Commit

Permalink
Merge pull request #2530 from epam/improvement/2495-horizontal-tab-bu…
Browse files Browse the repository at this point in the history
…tton-align-with-design-decrease-padding-to-3px-for-caption

[TabButton][VerticalTabButton]: Paddings & gaps decreased
  • Loading branch information
AlekseyManetov authored Oct 3, 2024
2 parents 541ff4d + 1c8b911 commit 38aa1cd
Show file tree
Hide file tree
Showing 48 changed files with 56 additions and 47 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Sass updated to the last version, warnings 'Mixed Declarations' fixed https://sass-lang.com/documentation/breaking-changes/mixed-decls/
* [DataTable]: - `ColumnsConfigurationModal` - updated modal width from 420px to 560px according design, 'disabled' state for locked columns is changed to 'readonly', added vertical paddings to multiline column names.
* [Modals]: for mobile view (width is up to 720px) by default the modal position is fixed at the bottom edge of the screen
* [TabButton][VerticalTabButton]: decreased paddings & gaps for all sizes according to the design

**What's Fixed**
*[VirtualList]: fixed offsets counting if rows have different height
Expand Down
4 changes: 2 additions & 2 deletions epam-assets/theme/theme_6px.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
}

.uui-tab-button:is(.uui-size-36, .uui-size-48, .uui-size-60) {
--uui-horizontal-padding: 12px;
--uui-horizontal-gap: 6px;
--uui-horizontal-padding: 6px;
--uui-horizontal-gap: 3px;
--uui-icon-size: 18px;
--uui-line-height: 18px;
--uui-font-size: 14px;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 18 additions & 35 deletions uui/components/buttons/TabButton.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
--uui-tab_btn-min-width: var(--uui-size);
--uui-tab_btn-padding: var(--uui-horizontal-padding);
--uui-tab_btn-gap: var(--uui-horizontal-gap);
--uui-tab_btn-notification-gap: 9px;
--uui-tab_btn-horizontal-caption-padding: var(--uui-horizontal-gap);
--uui-tab_btn-vertical-caption-padding: calc((var(--uui-tab_btn-height) - var(--uui-tab_btn-line-height)) / 2);
--uui-tab_btn-icon-height: var(--uui-icon-size);
Expand Down Expand Up @@ -79,48 +78,32 @@
}

:global(.uui-caption) {
display: flex;
position: relative;
height: var(--uui-tab_btn-line-height);
line-height: var(--uui-tab_btn-line-height);
font-size: var(--uui-tab_btn-font-size);
padding-top: var(--uui-tab_btn-vertical-caption-padding);
padding-bottom: var(--uui-tab_btn-vertical-caption-padding);
}

&:global {
&.uui-has-left-icon {
:global(.uui-caption) {
padding-inline-start: var(--uui-tab_btn-horizontal-caption-padding);
}
}

&.uui-has-right-icon {
:global(.uui-caption) {
padding-inline-end: var(--uui-tab_btn-horizontal-caption-padding);
}
padding-inline-start: var(--uui-tab_btn-horizontal-caption-padding);
padding-inline-end: var(--uui-tab_btn-horizontal-caption-padding);

.withNotify {
position: relative;
top: calc(0px - var(--uui-notify-size) / 2);
height: var(--uui-notify-size);
width: var(--uui-notify-size);
background: var(--uui-critical-50);
box-shadow: 0 1px 8px 0 var(--uui-critical-50);
border-radius: 50%;
}
}

&.withNotify {
:global(.uui-caption) {
padding-inline-end: var(--uui-tab_btn-notification-gap);

&::after {
content: '';
position: absolute;
height: var(--uui-notify-size);
width: var(--uui-notify-size);
background: var(--uui-critical-50);
box-shadow: 0 1px 8px 0 var(--uui-critical-50);
border-radius: 50%;
}
}
:global(.uui-icon) + :global(.uui-count_indicator) {
margin-inline-start: var(--uui-tab_btn-gap);
}

:global(.uui-count_indicator) {
margin-inline-start: calc(var(--uui-tab_btn-gap) / 2);
margin-inline-end: calc(var(--uui-tab_btn-gap) / 2);

~ :global(.uui-caption) {
padding-inline-end: 0;
}
:global(.uui-count_indicator):not(:last-child) {
margin-inline-end: var(--uui-tab_btn-gap);
}
}
15 changes: 7 additions & 8 deletions uui/components/buttons/TabButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { cx, Icon, IDropdownToggler, IHasCaption, IHasIcon, uuiElement, uuiMarkers, Overwrite } from '@epam/uui-core';
import { Clickable, ClickableComponentProps, IconContainer } from '@epam/uui-components';
import { getIconClass } from './helper';
import { CountIndicator } from '../widgets/CountIndicator';
import { CountIndicator, CountIndicatorProps } from '../widgets/CountIndicator';
import { systemIcons } from '../../icons/icons';
import { settings } from '../../settings';
import css from './TabButton.module.scss';
Expand Down Expand Up @@ -36,7 +36,6 @@ export const TabButton = React.forwardRef<HTMLButtonElement | HTMLAnchorElement
css.root,
'uui-tab-button',
`uui-size-${props.size || settings.sizes.defaults.tabButton}`,
props.withNotify && css.withNotify,
...getIconClass(props),
props.cx,
];
Expand All @@ -62,25 +61,25 @@ export const TabButton = React.forwardRef<HTMLButtonElement | HTMLAnchorElement
onClick={ !props.isDisabled ? props.onIconClick : undefined }
/>
) }
{ props.caption && (
{ (props.caption || props.withNotify) && (
<div className={ cx(uuiElement.caption) }>
{ props.caption }
{ props.withNotify && <div className={ css.withNotify } /> }
</div>
) }
{ props.icon && props.iconPosition === 'right' && (
<IconContainer icon={ props.icon } onClick={ !props.isDisabled ? props.onIconClick : undefined } />
) }
{ props.count !== undefined && props.count !== null && (
<CountIndicator
color="neutral"
size="18"
size={ settings.sizes.tabButton.countIndicator[props.size || settings.sizes.defaults.tabButton] as CountIndicatorProps['size'] }
caption={ props.count }
/>
) }
{ props.icon && props.iconPosition === 'right' && (
<IconContainer icon={ props.icon } onClick={ !props.isDisabled ? props.onIconClick : undefined } />
) }
{ props.isDropdown && (
<IconContainer icon={ DropdownIcon } flipY={ props.isOpen } />
)}

{ props.onClear && !props.isDisabled && (
<IconContainer cx={ uuiMarkers.clickable } icon={ ClearIcon } onClick={ props.onClear } />
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`TabButton should be rendered correctly 1`] = `
exports[`TabButton should be rendered correctly with props 1`] = `
<button
aria-disabled={false}
className="uui-button-box uui-enabled -clickable root uui-tab-button uui-size-48 withNotify uui-has-left-icon uui-no-right-icon"
className="uui-button-box uui-enabled -clickable root uui-tab-button uui-size-48 uui-has-left-icon uui-no-right-icon"
onClick={[Function]}
role="tab"
tabIndex={0}
Expand All @@ -25,5 +25,12 @@ exports[`TabButton should be rendered correctly with props 1`] = `
className=""
/>
</div>
<div
className="uui-caption"
>
<div
className="withNotify"
/>
</div>
</button>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`VerticalTabButton should be rendered correctly 1`] = `
exports[`VerticalTabButton should be rendered correctly with props 1`] = `
<button
aria-disabled={false}
className="uui-button-box uui-enabled -clickable root uui-tab-button uui-size-48 withNotify uui-has-left-icon uui-no-right-icon root uui-vertical-tab-button"
className="uui-button-box uui-enabled -clickable root uui-tab-button uui-size-48 uui-has-left-icon uui-no-right-icon root uui-vertical-tab-button"
onClick={[Function]}
role="tab"
tabIndex={0}
Expand All @@ -25,5 +25,12 @@ exports[`VerticalTabButton should be rendered correctly with props 1`] = `
className=""
/>
</div>
<div
className="uui-caption"
>
<div
className="withNotify"
/>
</div>
</button>
`;
7 changes: 7 additions & 0 deletions uui/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,12 @@ export const settings: Settings = {
},
},
},
tabButton: {
countIndicator: {
36: '18',
48: '18',
60: '18',
},
},
},
};
5 changes: 5 additions & 0 deletions uui/settings.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ interface DataTableSizes {
body: DataTableBodySizes;
}

interface TabButtonSizes {
countIndicator: Sizes;
}

interface ModalWindowDefaultSizes {
width: string;
}
Expand All @@ -238,6 +242,7 @@ interface SizesSettings {
badge: BadgeSizes;
dataTable: DataTableSizes;
modal: ModalSizes;
tabButton: TabButtonSizes;
}

export interface Settings {
Expand Down

0 comments on commit 38aa1cd

Please sign in to comment.