Skip to content

Commit

Permalink
refactor: improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackGlory committed Dec 31, 2023
1 parent c38f8c2 commit 13dbc4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function Editor({ id }: IEditorProps) {

<Switch
value={userScript.enabled}
onClick={async enabled => {
onChange={async enabled => {
await client.setUserScriptEnabled(id, enabled)

updateUserScript(userScript => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function UserScriptListItem({ client, userScript }: IUserScriptListItemProps) {
<div className='flex items-center gap-2 px-2'>
<Switch
value={userScript.enabled}
onClick={async enabled => {
onChange={async enabled => {
await client.setUserScriptEnabled(userScript.id, enabled)

updateState(state => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import classNames from 'classnames'

interface ISwitchProps {
value: boolean
onClick: (value: boolean) => void
onChange: (value: boolean) => void
}

export function Switch({ value, onClick }: ISwitchProps) {
export function Switch({ value, onChange }: ISwitchProps) {
return (
<HeadlessSwitch
title={value ? 'Disable' : 'Enable'}
checked={value}
onChange={onClick}
onChange={onChange}
className={classNames(
'inline-flex h-4 w-7 rounded-full items-center'
, value ? 'bg-gray-700' : 'bg-gray-300'
Expand Down

0 comments on commit 13dbc4d

Please sign in to comment.