Skip to content

Commit eb47d25

Browse files
committed
prefixed OnSetThemeCallback with Hds per review suggestion
1 parent 241ba51 commit eb47d25

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

packages/components/src/components/hds/theme-switcher/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type { HdsIconSignature } from '../icon/index.ts';
1717
import type HdsThemingService from '../../../services/hds-theming.ts';
1818
import type {
1919
HdsThemes,
20-
OnSetThemeCallback,
20+
HdsOnSetThemeCallback,
2121
} from '../../../services/hds-theming.ts';
2222

2323
interface ThemeOption {
@@ -39,7 +39,7 @@ interface HdsThemeSwitcherSignature {
3939
toggleIsFullWidth?: HdsDropdownToggleButtonSignature['Args']['isFullWidth'];
4040
hasDefaultOption?: boolean;
4141
hasSystemOption?: boolean;
42-
onSetTheme?: OnSetThemeCallback;
42+
onSetTheme?: HdsOnSetThemeCallback;
4343
};
4444
Element: HdsDropdownSignature['Element'];
4545
}

packages/components/src/services/hds-theming.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ type HdsThemingOptions = {
4242
type SetThemeArgs = {
4343
theme: HdsThemes | undefined;
4444
options?: HdsThemingOptions;
45-
onSetTheme?: OnSetThemeCallback;
45+
onSetTheme?: HdsOnSetThemeCallback;
4646
};
4747

48-
export type OnSetThemeCallbackArgs = {
48+
export type HdsOnSetThemeCallbackArgs = {
4949
currentTheme: HdsThemes | undefined;
5050
currentMode: HdsModes | undefined;
5151
};
5252

53-
export type OnSetThemeCallback = (args: OnSetThemeCallbackArgs) => void;
53+
export type HdsOnSetThemeCallback = (args: HdsOnSetThemeCallbackArgs) => void;
5454

5555
export const THEMES: HdsThemes[] = Object.values(HdsThemeValues);
5656
export const MODES_LIGHT: HdsModesLight[] = Object.values(HdsModesLightValues);
@@ -72,7 +72,7 @@ export default class HdsThemingService extends Service {
7272
@tracked _currentLightTheme: HdsModesLight =
7373
DEFAULT_THEMING_OPTION_LIGHT_THEME;
7474
@tracked _currentDarkTheme: HdsModesDark = DEFAULT_THEMING_OPTION_DARK_THEME;
75-
@tracked globalOnSetTheme: OnSetThemeCallback | undefined;
75+
@tracked globalOnSetTheme: HdsOnSetThemeCallback | undefined;
7676

7777
initializeTheme() {
7878
const rawStoredThemingData = localStorage.getItem(

showcase/app/components/page-foundations/theming/sub-sections/theme-switcher.gts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import { HdsThemeSwitcher } from '@hashicorp/design-system-components/components
1212
import ShwThemingService from 'showcase/services/shw-theming';
1313

1414
import type {
15-
OnSetThemeCallback,
16-
OnSetThemeCallbackArgs,
15+
HdsOnSetThemeCallback,
16+
HdsOnSetThemeCallbackArgs,
1717
} from '@hashicorp/design-system-components/services/hds-theming';
1818

1919
export default class SubSectionThemeSwitcher extends Component {
2020
@service declare readonly shwTheming: ShwThemingService;
2121

22-
onSetTheme: OnSetThemeCallback = ({
22+
onSetTheme: HdsOnSetThemeCallback = ({
2323
currentTheme,
24-
}: OnSetThemeCallbackArgs) => {
24+
}: HdsOnSetThemeCallbackArgs) => {
2525
if (
2626
this.shwTheming.currentStylesheet === 'standard' ||
2727
(currentTheme === 'default' &&

showcase/app/services/shw-theming.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { inject as service } from '@ember/service';
55
import HdsThemingService from '@hashicorp/design-system-components/services/hds-theming';
66

77
// import type {
8-
// OnSetThemeCallback,
9-
// OnSetThemeCallbackArgs,
8+
// HdsOnSetThemeCallback,
9+
// HdsOnSetThemeCallbackArgs,
1010
// } from '@hashicorp/design-system-components/services/hds-theming';
1111

1212
export type ShwStylesheets =
@@ -84,10 +84,10 @@ export default class ShwThemingService extends HdsThemingService {
8484
// example of how a consumer could use the `globalOnSetTheme` callback by extending the `hdsTheming` service
8585
// note: for this to work, the `setTheme` must be invoked using the `shwTheming` service: `this.shwTheming.setTheme()`
8686
//
87-
// globalOnSetTheme: OnSetThemeCallback = ({
87+
// globalOnSetTheme: HdsOnSetThemeCallback = ({
8888
// currentTheme,
8989
// currentMode,
90-
// }: OnSetThemeCallbackArgs) => {
90+
// }: HdsOnSetThemeCallbackArgs) => {
9191
// console.log(
9292
// 'ShwTheming Service -- globalOnSetTheme invoked',
9393
// currentTheme,

0 commit comments

Comments
 (0)