forked from nukeop/nuclear
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TS config for ui package, Add TrackPopup to ui
- Loading branch information
Showing
9 changed files
with
170 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
stories: [ | ||
'../stories/*.stories.js', | ||
'../stories/*.stories.tsx' | ||
], | ||
addons: [ | ||
'@storybook/preset-typescript', | ||
'@storybook/addon-actions', | ||
'@storybook/addon-links' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react'; | ||
|
||
import ContextPopup from '../ContextPopup'; | ||
import PopupButton from '../PopupButton'; | ||
import { Popup } from 'semantic-ui-react'; | ||
|
||
const TrackPopup: React.FC<{ | ||
trigger: React.ReactNode; | ||
artist: string; | ||
title: string; | ||
thumb: string; | ||
|
||
withAddToQueue: boolean; | ||
withPlayNow: boolean; | ||
withAddToFavorites: boolean; | ||
withAddToDownloads: boolean; | ||
|
||
onAddToQueue: () => void; | ||
onPlayNow: () => void; | ||
onAddToFavorites: () => void; | ||
onAddToDownloads: () => void; | ||
}> = ({ | ||
trigger, | ||
artist, | ||
title, | ||
thumb, | ||
withAddToQueue, | ||
withPlayNow, | ||
withAddToFavorites, | ||
withAddToDownloads, | ||
onAddToQueue, | ||
onPlayNow, | ||
onAddToFavorites, | ||
onAddToDownloads | ||
}) => ( | ||
<ContextPopup | ||
trigger={trigger} | ||
artist={artist} | ||
title={title} | ||
thumb={thumb} | ||
> | ||
{ | ||
withAddToQueue && | ||
<PopupButton | ||
onClick={onAddToQueue} | ||
ariaLabel='Add track to queue' | ||
icon='plus' | ||
label='Add to queue' | ||
/> | ||
} | ||
|
||
{ | ||
withPlayNow && | ||
<PopupButton | ||
onClick={onPlayNow} | ||
ariaLabel='Play this track now' | ||
icon='play' | ||
label='Play now' | ||
/> | ||
} | ||
|
||
{ | ||
withAddToFavorites && | ||
<PopupButton | ||
onClick={onAddToFavorites} | ||
ariaLabel='Add this track to favorites' | ||
icon='star' | ||
label='Add to favorites' | ||
/> | ||
} | ||
|
||
{ | ||
withAddToDownloads && | ||
<PopupButton | ||
onClick={onAddToDownloads} | ||
ariaLabel='Download this track' | ||
icon='download' | ||
label='Download' | ||
/> | ||
} | ||
</ContextPopup> | ||
); | ||
|
||
export default TrackPopup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { Button } from 'semantic-ui-react'; | ||
|
||
import { TrackPopup } from '..'; | ||
|
||
export default { | ||
title: 'Track popup' | ||
} | ||
|
||
const track = { | ||
artist: 'Test', | ||
title: 'Test title', | ||
thumb: 'https://i.imgur.com/4euOws2.jpg' | ||
}; | ||
|
||
export const WithNoButtons = () => <div className='bg'> | ||
<TrackPopup | ||
trigger={<Button>Click here</Button>} | ||
{...track} | ||
/> | ||
</div>; | ||
|
||
export const WithAllButtons = () => <div className='bg'> | ||
<TrackPopup | ||
trigger={<Button>Click here</Button>} | ||
{...track} | ||
withAddToQueue | ||
withPlayNow | ||
withAddToFavorites | ||
withAddToDownloads | ||
/> | ||
</div>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": ["DOM"], | ||
"declaration": true, | ||
"outDir": "dist", | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"strict": false, | ||
"typeRoots": [ | ||
"node_modules/@types" | ||
], | ||
"jsx": "react" | ||
}, | ||
"include": [ | ||
"lib", | ||
"stories" | ||
] | ||
} |