-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
991 additions
and
915 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
.env | ||
.env.* | ||
!.env.example | ||
|
||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
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,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"printWidth": 100 | ||
} |
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 |
---|---|---|
@@ -1,23 +1,17 @@ | ||
import m from 'mithril'; | ||
|
||
class AppHeaderComponent { | ||
|
||
view() { | ||
return m('.app-header', [ | ||
m('h1', 'Flip Book'), | ||
m('.app-header-mentions', [ | ||
m('span.app-header-mention', [ | ||
'By ', | ||
m('a[href="https://calebevans.me/"]', 'Caleb Evans'), | ||
'.' | ||
]), | ||
m('span.app-header-mention', [ | ||
'For my friend and brother, Bill.' | ||
]) | ||
]) | ||
]); | ||
return ( | ||
<div className="app-header"> | ||
<h1>Flip Book</h1> | ||
<div className="app-header-mentions"> | ||
<span className="app-header-mention"> | ||
By <a href="https://calebevans.me/">Caleb Evans</a>. | ||
</span> | ||
<span className="app-header-mention">For my friend and brother, Bill.</span> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default AppHeaderComponent; |
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 |
---|---|---|
@@ -1,34 +1,50 @@ | ||
import m from 'mithril'; | ||
import clsx from 'clsx'; | ||
import PanelComponent from './panel.jsx'; | ||
|
||
class ControlComponent { | ||
|
||
view({attrs: {id, title, icon = null, label = null, action = null, panel = null, panelPosition = 'top'}}) { | ||
return m(`div`, { | ||
class: clsx('control', `control-${id}`, {'control-has-label': label}) | ||
}, [ | ||
panel ? m(PanelComponent, {id, position: panelPosition}, panel) : null, | ||
m('button.control-button', { | ||
title, | ||
onclick: ({target}) => { | ||
if (panel) { | ||
PanelComponent.togglePanel(id); | ||
} else if (action) { | ||
// Do not close the panel where the clicked control resides | ||
if (!target.closest('.panel')) { | ||
PanelComponent.closeAllPanels(); | ||
view({ | ||
attrs: { | ||
id, | ||
title, | ||
icon = null, | ||
label = null, | ||
action = null, | ||
panel = null, | ||
panelPosition = 'top' | ||
} | ||
}) { | ||
return ( | ||
<div | ||
className={clsx('control', `control-${id}`, { | ||
'control-has-label': label | ||
})} | ||
> | ||
{panel ? ( | ||
<PanelComponent id={id} position={panelPosition}> | ||
{panel} | ||
</PanelComponent> | ||
) : null} | ||
<button | ||
className="control-button" | ||
title={title} | ||
onclick={({ target }) => { | ||
if (panel) { | ||
PanelComponent.togglePanel(id); | ||
} else if (action) { | ||
// Do not close the panel where the clicked control resides | ||
if (!target.closest('.panel')) { | ||
PanelComponent.closeAllPanels(); | ||
} | ||
action(); | ||
} | ||
action(); | ||
} | ||
} | ||
}, [ | ||
icon ? m('img.control-icon', {src: `icons/${icon}.svg`, alt: title}) : null, | ||
label ? m('span.control-label', label) : null | ||
]) | ||
]); | ||
}} | ||
> | ||
{icon ? <img className="control-icon" src={`icons/${icon}.svg`} alt={title} /> : null} | ||
{label ? <span className="control-label">{label}</span> : null} | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default ControlComponent; |
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 |
---|---|---|
@@ -1,36 +1,40 @@ | ||
import m from 'mithril'; | ||
import clsx from 'clsx'; | ||
import ControlComponent from './control.jsx'; | ||
import ProgressBarComponent from './progress-bar.jsx'; | ||
|
||
class ExportGifComponent { | ||
|
||
view({attrs: {isExportingGif, exportProgress, isGifExportFinished, exportedImageUrl, abort}}) { | ||
return m('div', { | ||
class: clsx('export-gif-screen', {'visible': isExportingGif || isGifExportFinished}) | ||
}, [ | ||
m(ControlComponent, { | ||
id: 'close-export-gif-overlay', | ||
title: isGifExportFinished ? 'Close overlay' : 'Abort GIF export', | ||
icon: 'close', | ||
action: () => abort() | ||
}), | ||
m('div.export-gif-overlay'), | ||
m('div.export-gif-heading', exportedImageUrl ? | ||
'GIF Generated!' : | ||
'Generating GIF...'), | ||
m('p.export-gif-message', exportedImageUrl ? | ||
'Right-click the image and choose "Save Image As..." to download.' : | ||
''), | ||
exportedImageUrl ? m('img.exported-image', { | ||
src: exportedImageUrl, | ||
alt: 'Exported GIF' | ||
}) : m(ProgressBarComponent, { | ||
progress: exportProgress | ||
}) | ||
]); | ||
view({ | ||
attrs: { isExportingGif, exportProgress, isGifExportFinished, exportedImageUrl, abort } | ||
}) { | ||
return ( | ||
<div | ||
className={clsx('export-gif-screen', { | ||
visible: isExportingGif || isGifExportFinished | ||
})} | ||
> | ||
<ControlComponent | ||
id="close-export-gif-overlay" | ||
title={isGifExportFinished ? 'Close overlay' : 'Abort GIF export'} | ||
icon="close" | ||
action={() => abort()} | ||
/> | ||
<div className="export-gif-overlay" /> | ||
<div className="export-gif-heading"> | ||
{exportedImageUrl ? 'GIF Generated!' : 'Generating GIF...'} | ||
</div> | ||
<p className="export-gif-message"> | ||
{exportedImageUrl | ||
? 'Right-click the image and choose "Save Image As..." to download.' | ||
: ''} | ||
</p> | ||
{exportedImageUrl ? ( | ||
<img className="exported-image" src={exportedImageUrl} alt="Exported GIF" /> | ||
) : ( | ||
<ProgressBarComponent progress={exportProgress} /> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default ExportGifComponent; |
Oops, something went wrong.