You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
add themes to the docs
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
|
||||
import { ray } from 'node-ray/web'
|
||||
|
||||
export default class extends Controller {
|
||||
initialize() {
|
||||
window.ray = ray
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/amazon/amazon.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.amazon')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/amber/amber.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.amber')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/aurora/aurora.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.aurora')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/crystal/crystal.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.crystal')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/emerald/emerald.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.emerald')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/facebook/facebook.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.facebook')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/flasher/flasher.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.flasher')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/google/google.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.google')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/ios/ios.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.ios')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/jade/jade.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.jade')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/material/material.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.material')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/minimal/minimal.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.minimal')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/neon/neon.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.neon')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/onyx/onyx.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.onyx')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/ruby/ruby.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.ruby')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/sapphire/sapphire.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.sapphire')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { showNotificationsForHandler } from '../show_notifications'
|
||||
|
||||
import '@flasher/flasher/dist/themes/slack/slack.min.css'
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
showNotificationsForHandler('theme.slack')
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,23 @@ import '@flasher/flasher-noty'
|
||||
import '@flasher/flasher-notyf'
|
||||
import '@flasher/flasher-sweetalert'
|
||||
|
||||
import '@flasher/flasher/dist/themes/amazon/amazon'
|
||||
import '@flasher/flasher/dist/themes/amber/amber'
|
||||
import '@flasher/flasher/dist/themes/aurora/aurora'
|
||||
import '@flasher/flasher/dist/themes/crystal/crystal'
|
||||
import '@flasher/flasher/dist/themes/emerald/emerald'
|
||||
import '@flasher/flasher/dist/themes/facebook/facebook'
|
||||
import '@flasher/flasher/dist/themes/google/google'
|
||||
import '@flasher/flasher/dist/themes/ios/ios'
|
||||
import '@flasher/flasher/dist/themes/jade/jade'
|
||||
import '@flasher/flasher/dist/themes/material/material'
|
||||
import '@flasher/flasher/dist/themes/minimal/minimal'
|
||||
import '@flasher/flasher/dist/themes/neon/neon'
|
||||
import '@flasher/flasher/dist/themes/onyx/onyx'
|
||||
import '@flasher/flasher/dist/themes/ruby/ruby'
|
||||
import '@flasher/flasher/dist/themes/sapphire/sapphire'
|
||||
import '@flasher/flasher/dist/themes/slack/slack'
|
||||
|
||||
window.flasher = flasher
|
||||
|
||||
export default class extends Controller {
|
||||
|
||||
@@ -14,15 +14,31 @@ function showNotifications(notifications) {
|
||||
export function showNotificationsForHandler(handler, options = {}) {
|
||||
const factory = flasher.use(handler)
|
||||
|
||||
factory.info('Welcome back', 'Info', options)
|
||||
// Handle theme-based handlers with different positions
|
||||
const isThemeHandler = handler.startsWith('theme.')
|
||||
|
||||
// Define position-specific options for theme handlers
|
||||
let infoOptions = { ...options }
|
||||
let errorOptions = { ...options }
|
||||
let warningOptions = { ...options }
|
||||
let successOptions = { ...options }
|
||||
|
||||
if (isThemeHandler) {
|
||||
infoOptions = { ...options, position: 'bottom-right' }
|
||||
errorOptions = { ...options, position: 'bottom-right' }
|
||||
warningOptions = { ...options, position: 'bottom-right' }
|
||||
successOptions = { ...options, position: 'bottom-right' }
|
||||
}
|
||||
|
||||
factory.info('Welcome back', 'Info', infoOptions)
|
||||
|
||||
if (['sweetalert'].includes(handler)) {
|
||||
return
|
||||
}
|
||||
|
||||
showNotifications([
|
||||
() => factory.error('Oops! Something went wrong!', 'Error', options),
|
||||
() => factory.warning('Are you sure you want to proceed ?', 'Warning', options),
|
||||
() => factory.success('Data has been saved successfully!', 'Success', options),
|
||||
() => factory.error('Oops! Something went wrong!', 'Error', errorOptions),
|
||||
() => factory.warning('Are you sure you want to proceed?', 'Warning', warningOptions),
|
||||
() => factory.success('Data has been saved successfully!', 'Success', successOptions),
|
||||
])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user