Skip to content

Commit

Permalink
Improve experience for audio files (#85)
Browse files Browse the repository at this point in the history
Upgrade dependencies and `<MediaPoster>`
  • Loading branch information
bragaru-i authored Oct 30, 2022
1 parent 67ffae4 commit ec10c49
Show file tree
Hide file tree
Showing 7 changed files with 491 additions and 483 deletions.
4 changes: 2 additions & 2 deletions .storybook/stories/12-AudioPlayer.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import {
} from '../../src/components/media-player/MediaPlayer';
import { withDemoCard, withIntl } from '../decorators';

export const AudioPlayer: Story<MediaPlayerProps> = args => {
export const Default: Story<MediaPlayerProps> = args => {
return <MediaPlayerComponent {...args} />;
};

export default {
title: 'Audio Player',
component: AudioPlayer,
component: Default,
decorators: [withDemoCard, withIntl],
args: {
url: `https://assets.mixkit.co/sfx/preview/mixkit-game-show-suspense-waiting-667.mp3`,
Expand Down
85 changes: 85 additions & 0 deletions .storybook/stories/13-CustomizedAudioPlayer.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { Meta, Story } from '@storybook/react';
import { makeStyles } from 'tss-react/mui';

import {
MediaPoster,
PlayPauseReplay,
CorePlayer,
CorePlayerProps,
FwdButton,
RwdButton,
TimeDisplay,
} from '../../src/';
import { withDemoCard, withIntl } from '../decorators';

const useStyles = makeStyles()(theme => ({
dimension: {
// 16:9 aspect ratio
width: theme.spacing(90),
height: theme.spacing(50.625),
},
placeholder: {
position: 'absolute',
width: '100%',
height: '100%',
},
buttons: {
position: 'absolute',
top: '50%',
right: '50%',
transform: 'translate(50%,-50%)',
},
}));

export const Customized: Story<CorePlayerProps> = args => {
const { dimension, placeholder, buttons } = useStyles().classes;
return (
<CorePlayer className={dimension} {...args}>
<div className={placeholder}>
<MediaPoster
img="https://picsum.photos/300/200"
width="100%"
height="100%"
/>
<div className={buttons}>
<RwdButton />
<PlayPauseReplay size="large" />
<FwdButton />
<TimeDisplay />
</div>
</div>
</CorePlayer>
);
};

export default {
title: 'Audio Player',
component: Customized,
decorators: [withDemoCard, withIntl],
args: {
url: `https://assets.mixkit.co/sfx/preview/mixkit-game-show-suspense-waiting-667.mp3`,
audioPlaceholder: undefined,
},
argTypes: {
url: {
name: 'props.url',
description: 'A media URL. Only file type supported',
table: {
type: { summary: 'string' },
defaultValue: { summary: undefined },
},
},
audioPlaceholder: {
name: 'props.audioPlaceholder',
description:
'URL to a image to be a placeholder for audio files in PIP mode',
table: {
type: { summary: 'string' },
defaultValue: { summary: undefined },
},
},
},
parameters: {
controls: { expanded: true },
},
} as Meta;
Loading

0 comments on commit ec10c49

Please sign in to comment.