-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from lexesjan/add-skip-preview-behaviour-option
Add skip preview behaviour option
- Loading branch information
Showing
15 changed files
with
151 additions
and
29 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
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
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
import React from 'react'; | ||
import { | ||
HiArrowDown, | ||
HiArrowLeft, | ||
HiArrowRight, | ||
HiArrowUp, | ||
} from 'react-icons/hi'; | ||
import { ComponentPropsWithAs } from '../../utils'; | ||
|
||
export type KeyboardProps<TTag extends React.ElementType> = | ||
ComponentPropsWithAs<TTag>; | ||
|
||
export const DEFAULT_KEYBOARD_TAG = 'span' as const; | ||
|
||
export const KEYBOARD_DISPLAY: Record<string, React.ReactNode> = { | ||
ArrowUp: <HiArrowUp />, | ||
ArrowDown: <HiArrowDown />, | ||
ArrowLeft: <HiArrowLeft />, | ||
ArrowRight: <HiArrowRight />, | ||
Control: 'Ctrl', | ||
Backspace: '⌫', | ||
Delete: 'Del', | ||
Escape: 'Esc', | ||
PageUp: 'PgUp', | ||
PageDown: 'PgDn', | ||
Space: '␣', | ||
} as const; |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Switch } from '@headlessui/react'; | ||
import React from 'react'; | ||
import { FaCheck, FaTimes } from 'react-icons/fa'; | ||
import { ToggleProps } from './Toggle.types'; | ||
|
||
export function Toggle({ | ||
className = '', | ||
checked, | ||
onChange, | ||
children, | ||
}: ToggleProps): JSX.Element { | ||
return ( | ||
<Switch | ||
className={`${ | ||
checked ? 'bg-green-600' : 'bg-gray-500' | ||
} transition-colors relative inline-flex flex-shrink-0 items-center h-6 rounded-full w-10 ${className}`} | ||
checked={checked} | ||
onChange={onChange} | ||
> | ||
{children} | ||
<span | ||
aria-hidden="true" | ||
className={`${ | ||
checked ? 'translate-x-[1.125em]' : 'translate-x-1' | ||
} transition absolute flex items-center justify-center w-[1.125em] h-[1.125em] transform bg-white rounded-full`} | ||
> | ||
{checked ? ( | ||
<FaCheck className="text-green-600 w-3 h-3" /> | ||
) : ( | ||
<FaTimes className="text-gray-500 w-4- h-4" /> | ||
)} | ||
</span> | ||
</Switch> | ||
); | ||
} |
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,6 @@ | ||
export type ToggleProps = { | ||
className?: string; | ||
checked: boolean; | ||
onChange: (value: boolean) => void; | ||
children?: React.ReactNode; | ||
}; |
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,2 @@ | ||
export * from './Toggle'; | ||
export * from './Toggle.types'; |
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
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
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