Skip to content

Commit

Permalink
overlay: Add example overlay as a template
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Jul 15, 2020
1 parent dc41fe4 commit 460874a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 42 deletions.
34 changes: 0 additions & 34 deletions src/overlay/overlays/cueCounter/index.tsx

This file was deleted.

39 changes: 39 additions & 0 deletions src/overlay/overlays/example/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as React from 'react';
import {observer} from 'mobx-react';

import {OverlayDescriptor} from 'src/overlay';

type Config = {
/**
* Should the
*/
alginRight: boolean;
};

const Overlay: React.FC<{config: Config}> = observer(() => {
return <div>This is a cue counter</div>;
});

const ConfigInterface: React.FC<{config: Config}> = observer(() => {
return <div>This is the config interface</div>;
});

const Example: React.FC<{config?: Config}> = () => {
return <div>This is an example of the </div>;
};

export type ExampleOverlay = {
type: 'example';
config: Config;
};

const descriptor: OverlayDescriptor<ExampleOverlay> = {
type: 'example',
name: 'Example Overlay Configuration',
component: Overlay,
configInterface: ConfigInterface,
example: Example,
defaultConfig: {},
};

export default descriptor;
12 changes: 4 additions & 8 deletions src/overlay/overlays/taggedNowPlaying/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ type Props = {
history: PlayedTrack[];
};

const Overlay: React.FC<Props> = observer(({config, history}) => {
console.log(history);
return history.length === 0 ? null : (
const Overlay: React.FC<Props> = observer(({config, history}) =>
history.length === 0 ? null : (
<React.Fragment>
<CurrentTrack
alignRight={config.alignRight}
Expand All @@ -86,8 +85,8 @@ const Overlay: React.FC<Props> = observer(({config, history}) => {
</RecentWrapper>
)}
</React.Fragment>
);
});
)
);

const RecentWrapper = styled('div')`
display: grid;
Expand Down Expand Up @@ -122,9 +121,6 @@ const EmptyExample = styled('div')`

const Example: React.FC<{config?: Config}> = ({config}) => {
const history = useRandomHistory({cutoff: 5, updateInterval: 5000});

console.log(history);

return history.length === 0 ? (
<EmptyExample />
) : (
Expand Down

1 comment on commit 460874a

@vercel
Copy link

@vercel vercel bot commented on 460874a Jul 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.