Skip to content

Commit

Permalink
Replace classnames utility with clsx
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed Aug 21, 2024
1 parent 04d9994 commit 8210b4e
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"homepage": "https://gitlab.com/caleb531/flip-book#README",
"dependencies": {
"@fontsource/roboto-slab": "^5.0.20",
"clsx": "^2.1.1",
"fastclick": "^1.0.6",
"gif.js.optimized": "^1.0.1",
"mithril": "^2.2.2",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions scripts/classnames.js

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/components/control.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import m from 'mithril';
import classNames from '../classnames.js';
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.control.control-${id}`, {
class: classNames({'control-has-label': label})
class: clsx({'control-has-label': label})
}, [
panel ? m(PanelComponent, {id, position: panelPosition}, panel) : null,
m('button.control-button', {
Expand Down
4 changes: 2 additions & 2 deletions scripts/components/export-gif.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import m from 'mithril';
import classNames from '../classnames.js';
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.export-gif-screen', {
class: classNames({'visible': isExportingGif || isGifExportFinished})
class: clsx({'visible': isExportingGif || isGifExportFinished})
}, [
m(ControlComponent, {
id: 'close-export-gif-overlay',
Expand Down
4 changes: 2 additions & 2 deletions scripts/components/progress-bar.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import m from 'mithril';
import classNames from '../classnames.js';
import clsx from 'clsx';

class ProgressBarComponent {

view({attrs: {progress = 0}}) {
return m('div.progress-bar', [
m('div.progress-bar-current-progress', {
class: classNames({'no-progress': progress === 0}),
class: clsx({'no-progress': progress === 0}),
style: {width: `${progress * 100}%`}
})
]);
Expand Down
4 changes: 2 additions & 2 deletions scripts/components/story-editor.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import m from 'mithril';
import classNames from '../classnames.js';
import clsx from 'clsx';
import FrameComponent from './frame.jsx';
import DrawingAreaComponent from './drawing-area.jsx';
import StoryControlsComponent from './story-controls.jsx';
Expand All @@ -8,7 +8,7 @@ class StoryEditorComponent {

view({attrs: {story}}) {
return m('div.story-editor', {
class: classNames({'story-playing': story.playing})
class: clsx({'story-playing': story.playing})
}, [

m('div.story-stage', [
Expand Down
4 changes: 2 additions & 2 deletions scripts/components/timeline.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import m from 'mithril';
import classNames from '../classnames.js';
import clsx from 'clsx';
import FrameComponent from './frame.jsx';

const FRAME_THUMBNAIL_WIDTH = 128;
Expand Down Expand Up @@ -88,7 +88,7 @@ class TimelineComponent {
oncreate: ({dom}) => this.scrollSelectedThumbnailIntoView(dom),
// Scroll selected frame into view when navigating frames (Prev/Next)
onupdate: ({dom}) => this.scrollSelectedThumbnailIntoView(dom),
class: classNames({'selected': story.selectedFrameIndex === f}),
class: clsx({'selected': story.selectedFrameIndex === f}),
'data-index': f
}, m(FrameComponent, {
className: 'timeline-thumbnail-canvas',
Expand Down
4 changes: 2 additions & 2 deletions scripts/components/update-notification.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import m from 'mithril';
import classNames from '../classnames.js';
import clsx from 'clsx';
import { registerSW } from 'virtual:pwa-register';

class UpdateNotificationComponent {
Expand Down Expand Up @@ -30,7 +30,7 @@ class UpdateNotificationComponent {

view() {
return m('div.update-notification', {
class: classNames({ 'update-available': this.isUpdateAvailable }),
class: clsx({ 'update-available': this.isUpdateAvailable }),
onclick: () => this.update()
}, [
m('span.update-notification-message', 'Update available! Click here to update.')
Expand Down

0 comments on commit 8210b4e

Please sign in to comment.