mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
refactor(packages): derive default props from core classes (#488)
This commit is contained in:
@@ -20,8 +20,8 @@ export class FullscreenButtonElement extends MediaElement {
|
||||
disabled: { type: Boolean },
|
||||
};
|
||||
|
||||
label = '';
|
||||
disabled = false;
|
||||
label = FullscreenButtonCore.defaultProps.label;
|
||||
disabled = FullscreenButtonCore.defaultProps.disabled;
|
||||
|
||||
readonly #core = new FullscreenButtonCore();
|
||||
readonly #state = new PlayerController(this, playerContext, selectFullscreen);
|
||||
|
||||
@@ -20,8 +20,8 @@ export class MuteButtonElement extends MediaElement {
|
||||
disabled: { type: Boolean },
|
||||
};
|
||||
|
||||
label = '';
|
||||
disabled = false;
|
||||
label = MuteButtonCore.defaultProps.label;
|
||||
disabled = MuteButtonCore.defaultProps.disabled;
|
||||
|
||||
readonly #core = new MuteButtonCore();
|
||||
readonly #state = new PlayerController(this, playerContext, selectVolume);
|
||||
|
||||
@@ -20,8 +20,8 @@ export class PlayButtonElement extends MediaElement {
|
||||
disabled: { type: Boolean },
|
||||
};
|
||||
|
||||
label = '';
|
||||
disabled = false;
|
||||
label = PlayButtonCore.defaultProps.label;
|
||||
disabled = PlayButtonCore.defaultProps.disabled;
|
||||
|
||||
readonly #core = new PlayButtonCore();
|
||||
readonly #state = new PlayerController(this, playerContext, selectPlayback);
|
||||
|
||||
@@ -15,9 +15,9 @@ export class TimeElement extends MediaElement {
|
||||
label: { type: String },
|
||||
};
|
||||
|
||||
type: TimeType = 'current';
|
||||
negativeSign = '-';
|
||||
label = '';
|
||||
type: TimeType = TimeCore.defaultProps.type;
|
||||
negativeSign = TimeCore.defaultProps.negativeSign;
|
||||
label = TimeCore.defaultProps.label;
|
||||
|
||||
readonly #core = new TimeCore();
|
||||
readonly #state = new PlayerController(this, playerContext, selectTime);
|
||||
|
||||
@@ -18,7 +18,7 @@ export const FullscreenButton = forwardRef(function FullscreenButton(
|
||||
componentProps: FullscreenButtonProps,
|
||||
forwardedRef: ForwardedRef<HTMLButtonElement>
|
||||
) {
|
||||
const { render, className, style, label, disabled = false, ...elementProps } = componentProps;
|
||||
const { render, className, style, label, disabled, ...elementProps } = componentProps;
|
||||
|
||||
const fullscreen = usePlayer(selectFullscreen);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export const MuteButton = forwardRef(function MuteButton(
|
||||
componentProps: MuteButtonProps,
|
||||
forwardedRef: ForwardedRef<HTMLButtonElement>
|
||||
) {
|
||||
const { render, className, style, label, disabled = false, ...elementProps } = componentProps;
|
||||
const { render, className, style, label, disabled, ...elementProps } = componentProps;
|
||||
|
||||
const volume = usePlayer(selectVolume);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export const PlayButton = forwardRef(function PlayButton(
|
||||
componentProps: PlayButtonProps,
|
||||
forwardedRef: ForwardedRef<HTMLButtonElement>
|
||||
) {
|
||||
const { render, className, style, label, disabled = false, ...elementProps } = componentProps;
|
||||
const { render, className, style, label, disabled, ...elementProps } = componentProps;
|
||||
|
||||
const playback = usePlayer(selectPlayback);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ export const Value = forwardRef(function Value(
|
||||
|
||||
const content = state.negative ? (
|
||||
<>
|
||||
<span aria-hidden="true">{negativeSign ?? '-'}</span>
|
||||
<span aria-hidden="true">{negativeSign ?? TimeCore.defaultProps.negativeSign}</span>
|
||||
{state.text}
|
||||
</>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user