Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct style load for lang control at static mode #237

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/components/Controls/Controls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,12 @@

&__list {
padding: 4px 0;

&_langs {
width: 100px;
}
}

&__list-icon {
font-size: 22px;
}

&__lang-item {
--g-focus-border-radius: 4px;

display: flex;
gap: 8px;
align-items: center;
width: 100%;
height: 100%;
border-radius: var(--g-focus-border-radius);
border: 0;
padding: 0 12px;
color: inherit;
cursor: inherit;
background-color: inherit;
font-family: inherit;

@include focusable(-2px);

}

&__icon-rotated {
transform: rotate(90deg);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
.dc-controls__lang-item {
padding: 0 18px;
@import '../../../../styles/mixins';
@import '../../../../styles/variables';

.dc-lang-control {
display: flex;
align-items: center;
@include text-size(body-1);

&__popup {
width: 100px;
@include text-size(body-1);
}

&__popup-tooltip {
padding: 0;
}

&__list {
padding: 4px 0;
}

&__list-item {
--g-focus-border-radius: 4px;

display: flex;
gap: 8px;
align-items: center;
width: 100%;
height: 100%;
border-radius: var(--g-focus-border-radius);
border: 0;
padding: 0 12px;
color: inherit;
cursor: inherit;
background-color: inherit;
font-family: inherit;

@include focusable(-2px);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {getPopupPosition} from '../../../../utils';
import {Control} from '../../../Control';
import {ControlsLayoutContext} from '../../ControlsLayout';

import '../../Controls.scss';
import './LangControl.scss';

const DEFAULT_LANGS = ['en', 'ru', 'he'];
Expand All @@ -21,7 +20,7 @@ const LEGACY_LANG_ITEMS = [
{value: Lang.He, text: 'Hebrew'},
];

const b = block('dc-controls');
const b = block('dc-lang-control');

interface ControlProps {
lang: Lang;
Expand Down Expand Up @@ -62,7 +61,7 @@ const LangControl = (props: ControlProps) => {
return preparedLangs.length ? preparedLangs : LEGACY_LANG_ITEMS;
}, [langs]);
const renderItem = useCallback((item: ListItem) => {
return <button className={b('lang-item')}>{item.text}</button>;
return <button className={b('list-item')}>{item.text}</button>;
}, []);
const onItemClick = useCallback(
(item: ListItem) => {
Expand Down Expand Up @@ -95,12 +94,13 @@ const LangControl = (props: ControlProps) => {
onCloseClick={popupState.close}
onOpenChange={onOpenChange}
className={controlClassName}
contentClassName={b('popup')}
tooltipContentClassName={b('popup-tooltip')}
content={
<List
role={'list'}
filterable={false}
className={b('list', {langs: true})}
className={b('list')}
items={langItems}
onItemClick={onItemClick}
selectedItemIndex={selectedItemIndex}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
&__text-size-control {
display: flex;
align-items: center;

}

&__text-size-button {
Expand Down Expand Up @@ -51,7 +50,6 @@
display: flex;
padding: 12px;
width: 100%;

}

&__list-item-description {
Expand Down Expand Up @@ -79,8 +77,10 @@

&__popup-tooltip {
position: fixed;
/* stylelint-disable-next-line declaration-no-important */
inset: var(--header-height) 0px auto 0px !important;
transform: translate3d(0,0,0) !important;
/* stylelint-disable-next-line declaration-no-important */
transform: translate3d(0, 0, 0) !important;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-commit hook was throw error, need fix at separate PR

}

&__popup-tooltip-content {
Expand Down
Loading