Skip to content

Commit 74ef6ce

Browse files
andrey-sklvkrolJetBrainsTeamCity
authored
Merge 6.x into master (#7657)
* RG-2293 Get rid of side effects in setState updater function of Select component (#7574) * 6.0.50 * RG-2462 switch sidebar and main background in dark theme (#7565) (cherry picked from commit 647dd76) * 6.0.51 * Support passing theme down via React Context (#7592) * 6.0.52 * RG-2420 chore: undeprecate "Badge" in 6.x version * Chore: export GLOBAL_DARK_CLASS_NAME constant [publish] * 6.0.53 * JT-83359 Enable back controlling shortcuts by having '.ring-js-shortcuts' on parent, removed in 473d554 (#7637) * RG-2473 don't unmount react root because it can be reused later (#7656) minor: log auth error * Revert "RG-2420 chore: undeprecate "Badge" in 6.x version" This reverts commit 580369f. --------- Co-authored-by: Veniamin Krol <153412+vkrol@users.noreply.github.com> Co-authored-by: JetBrains Ring UI Automation <npmjs-buildserver@jetbrains.com>
1 parent 6334041 commit 74ef6ce

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

.storybook/preview.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import URLSearchParams from '@ungap/url-search-params';
66
import {Component} from '@storybook/addon-docs';
77
import {Parameters} from '@storybook/react';
88

9-
import Theme, {applyTheme} from '../src/global/theme';
9+
import Theme, {applyTheme, GLOBAL_DARK_CLASS_NAME} from '../src/global/theme';
1010

1111
import styles from './preview.css';
1212
import strictModeDecorator from './strict-mode-decorator';
@@ -47,7 +47,7 @@ export const parameters = {
4747
default: 'Light',
4848
list: [
4949
{name: 'Light', color: '#FFF'},
50-
{name: 'Dark', class: 'ring-ui-theme-dark', color: '#23272b'}
50+
{name: 'Dark', class: GLOBAL_DARK_CLASS_NAME, color: '#23272b'}
5151
]
5252
}
5353
};

src/global/theme.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Text from '../text/text';
55

66
import Select from '../select/select';
77

8-
import Theme, {ThemeProvider} from './theme';
8+
import Theme, {GLOBAL_DARK_CLASS_NAME, ThemeProvider} from './theme';
99

1010
export default {
1111
title: 'Components/Theme Provider'
@@ -29,7 +29,7 @@ const ThemedWrapper: React.FC<{children: React.ReactNode}> = ({children}) => (
2929
export const basic = () => {
3030
const ThemeExample: React.FC = () => (
3131
<div>
32-
<div className="ring-ui-theme-dark">
32+
<div className={GLOBAL_DARK_CLASS_NAME}>
3333
<ThemedWrapper>
3434
<Text>This is dark (via global css class)</Text>
3535
</ThemedWrapper>

src/global/theme.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ enum Theme {
2929

3030
export const ThemeContext = createContext<{theme: Theme.LIGHT | Theme.DARK}>({theme: Theme.LIGHT});
3131

32-
const GLOBAL_DARK_CLASS_NAME = 'ring-ui-theme-dark';
32+
export const GLOBAL_DARK_CLASS_NAME = 'ring-ui-theme-dark';
3333

3434
const darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
3535

src/header/smart-profile.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export default class SmartProfile extends PureComponent<SmartProfileProps, Smart
4646
try {
4747
await this.props.auth.login();
4848
} catch (err) {
49-
// do nothing
49+
// eslint-disable-next-line no-console
50+
console.debug('Profile login errored', err);
5051
} finally {
5152
this.setState({loading: false});
5253
}

src/login-dialog/service.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export default function showAuthDialog(props: LoginDialogAttrs = {onCancel: noop
2828
});
2929

3030
return () => {
31-
reactRoot.unmount();
31+
renderLoginDialog({
32+
...props,
33+
show: false
34+
});
3235
};
3336
}

src/shortcuts/core.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,11 @@ class Shortcuts {
218218
!(element instanceof HTMLElement) ||
219219
key == null ||
220220
element.matches(this.ALLOW_SHORTCUTS_SELECTOR) ||
221-
(element.dataset.enabledShortcuts != null
222-
? element.dataset.enabledShortcuts.split(',').includes(key)
223-
: element.closest(this.ALLOW_SHORTCUTS_SELECTOR) != null)
221+
element.closest(this.ALLOW_SHORTCUTS_SELECTOR) != null ||
222+
(
223+
element.dataset.enabledShortcuts != null &&
224+
element.dataset.enabledShortcuts.split(',').includes(key)
225+
)
224226
) {
225227
return false;
226228
}

0 commit comments

Comments
 (0)