Skip to content

Commit 1913616

Browse files
committed
fix(datetime): revert phosphor icons removal
1 parent 4e607ca commit 1913616

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

core/src/components/datetime/datetime.tsx

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import caretLeftRegular from '@phosphor-icons/core/assets/regular/caret-left.svg';
2+
import caretRightRegular from '@phosphor-icons/core/assets/regular/caret-right.svg';
13
import type { ComponentInterface, EventEmitter } from '@stencil/core';
24
import { Component, Element, Event, Host, Method, Prop, State, Watch, h, writeTask } from '@stencil/core';
35
import { startFocusVisible } from '@utils/focus-visible';
@@ -2627,19 +2629,45 @@ export class Datetime implements ComponentInterface {
26272629
}
26282630

26292631
/**
2630-
* Get the next month icon from the config.
2632+
* Get the icon to use for the next icon.
2633+
* Otherwise, use the icon set in the config.
26312634
* If no icon is set in the config, use the default icon.
26322635
*/
26332636
get datetimeNextIcon(): string {
2634-
return config.get('datetimeNextIcon', chevronForward);
2637+
// Determine the theme and map to default icons
2638+
const theme = getIonTheme(this);
2639+
const defaultIcons = {
2640+
ios: chevronForward,
2641+
ionic: caretRightRegular,
2642+
md: chevronForward,
2643+
};
2644+
2645+
// Get the default icon based on the theme, falling back to 'md' icon if necessary
2646+
const defaultIcon = defaultIcons[theme] || defaultIcons.md;
2647+
2648+
// Return the configured datetime next icon or the default icon
2649+
return config.get('datetimeNextIcon', defaultIcon);
26352650
}
26362651

26372652
/**
2638-
* Get the previous month icon from the config.
2653+
* Get the icon to use for the previous icon.
2654+
* Otherwise, use the icon set in the config.
26392655
* If no icon is set in the config, use the default icon.
26402656
*/
26412657
get datetimePreviousIcon(): string {
2642-
return config.get('datetimePreviousIcon', chevronBack);
2658+
// Determine the theme and map to default icons
2659+
const theme = getIonTheme(this);
2660+
const defaultIcons = {
2661+
ios: chevronBack,
2662+
ionic: caretLeftRegular,
2663+
md: chevronBack,
2664+
};
2665+
2666+
// Get the default icon based on the theme, falling back to 'md' icon if necessary
2667+
const defaultIcon = defaultIcons[theme] || defaultIcons.md;
2668+
2669+
// Return the configured datetime previous icon or the default icon
2670+
return config.get('datetimePreviousIcon', defaultIcon);
26432671
}
26442672

26452673
/**

0 commit comments

Comments
 (0)