jeansaad/hotel

View on GitHub
src/app/components/Switch/index.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import * as React from 'react'
import './index.css'

export interface IProps {
  onClick?: () => void
  checked?: boolean
}

function Switch({ onClick = () => null, checked }: IProps) {
  return (
    <label
      className="switch"
      onClick={e => {
        e.stopPropagation()
        e.preventDefault()
        onClick()
      }}
    >
      <input type="checkbox" checked={checked} />
      <span className="slider" title="Toggle monitor (shift + alt + ,)" />
    </label>
  )
}

export default Switch