-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add settings UI for BeatSaber data source
- Loading branch information
Showing
18 changed files
with
273 additions
and
140 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { FC, PropsWithChildren } from 'react'; | ||
|
||
export const ExternalLink: FC<PropsWithChildren<{ href: string }>> = ({ href, children }) => | ||
<a href={href} target="_blank" rel="noreferrer noopener">{children}</a>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import * as styles from '../../scss/modules/labelledInput.module.scss'; | ||
import { | ||
ChangeEventHandler, | ||
forwardRef, | ||
ForwardRefRenderFunction, | ||
PropsWithChildren, | ||
useId | ||
} from 'react'; | ||
|
||
export interface LabelledInputProps extends PropsWithChildren { | ||
type: 'checkbox' | 'radio'; | ||
name?: string; | ||
value?: string; | ||
checked?: boolean; | ||
displayName: string; | ||
onChange: ChangeEventHandler<HTMLInputElement>; | ||
} | ||
|
||
const LabelledInputComponent: ForwardRefRenderFunction<HTMLInputElement, LabelledInputProps> = ({ | ||
type, | ||
name, | ||
value, | ||
checked, | ||
displayName, | ||
children, | ||
onChange | ||
}, ref) => { | ||
const id = useId(); | ||
return <div className={styles['labelled-input']}> | ||
<input | ||
id={id} | ||
type={type} | ||
name={name} | ||
value={value} | ||
checked={checked} | ||
onChange={onChange} | ||
ref={ref} | ||
/> | ||
<label htmlFor={id}> | ||
<span>{displayName}</span> | ||
{children} | ||
</label> | ||
</div>; | ||
}; | ||
|
||
export const LabelledInput = forwardRef(LabelledInputComponent); |
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
Oops, something went wrong.