refactor: format and lint codebase (#971)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { FunctionComponent } from 'preact'
|
||||
|
||||
export const Title: FunctionComponent = ({ children }) => (
|
||||
<>
|
||||
<h2 className="text-base m-0 mb-1">{children}</h2>
|
||||
<div className="min-h-2" />
|
||||
</>
|
||||
)
|
||||
|
||||
export const Subtitle: FunctionComponent<{ className?: string }> = ({
|
||||
children,
|
||||
className = '',
|
||||
}) => <h4 className={`font-medium text-sm m-0 mb-1 ${className}`}>{children}</h4>
|
||||
|
||||
export const SubtitleLight: FunctionComponent<{ className?: string }> = ({
|
||||
children,
|
||||
className = '',
|
||||
}) => <h4 className={`font-normal text-sm m-0 mb-1 ${className}`}>{children}</h4>
|
||||
|
||||
export const Text: FunctionComponent<{ className?: string }> = ({ children, className = '' }) => (
|
||||
<p className={`${className} text-xs`}>{children}</p>
|
||||
)
|
||||
|
||||
const buttonClasses =
|
||||
'block bg-default color-text rounded border-solid \
|
||||
border-1 px-4 py-1.75 font-bold text-sm fit-content \
|
||||
focus:bg-contrast hover:bg-contrast border-main'
|
||||
|
||||
export const LinkButton: FunctionComponent<{
|
||||
label: string
|
||||
link: string
|
||||
className?: string
|
||||
}> = ({ label, link, className }) => (
|
||||
<a target="_blank" className={`${className} ${buttonClasses}`} href={link}>
|
||||
{label}
|
||||
</a>
|
||||
)
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Icon } from '@/Components/Icon'
|
||||
import { FunctionComponent } from 'preact'
|
||||
import { IconType } from '@standardnotes/snjs'
|
||||
|
||||
interface Props {
|
||||
iconType: IconType
|
||||
label: string
|
||||
selected: boolean
|
||||
onClick: () => void
|
||||
}
|
||||
|
||||
export const MenuItem: FunctionComponent<Props> = ({ iconType, label, selected, onClick }) => (
|
||||
<div
|
||||
className={`preferences-menu-item select-none ${selected ? 'selected' : ''}`}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
onClick()
|
||||
}}
|
||||
>
|
||||
<Icon className="icon" type={iconType} />
|
||||
<div className="min-w-1" />
|
||||
{label}
|
||||
</div>
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
import { FunctionComponent } from 'preact'
|
||||
import { HorizontalSeparator } from '@/Components/Shared/HorizontalSeparator'
|
||||
|
||||
const HorizontalLine: FunctionComponent<{ index: number; length: number }> = ({ index, length }) =>
|
||||
(index < length - 1 ? <HorizontalSeparator classes="my-4" /> : null)
|
||||
|
||||
export const PreferencesGroup: FunctionComponent = ({ children }) => (
|
||||
<div className="bg-default border-1 border-solid rounded border-main px-6 py-6 flex flex-col mb-3">
|
||||
{Array.isArray(children)
|
||||
? children
|
||||
.filter((child) => child != undefined && child !== '' && child !== false)
|
||||
.map((child, i, arr) => (
|
||||
<>
|
||||
{child}
|
||||
<HorizontalLine index={i} length={arr.length} />
|
||||
</>
|
||||
))
|
||||
: children}
|
||||
</div>
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
import { FunctionComponent } from 'preact'
|
||||
|
||||
export const PreferencesPane: FunctionComponent = ({ children }) => (
|
||||
<div className="color-foreground flex-grow flex flex-row overflow-y-auto min-h-0">
|
||||
<div className="flex-grow flex flex-col py-6 items-center">
|
||||
<div className="w-125 max-w-125 flex flex-col">
|
||||
{children != undefined && Array.isArray(children)
|
||||
? children.filter((child) => child != undefined)
|
||||
: children}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-basis-55 flex-shrink" />
|
||||
</div>
|
||||
)
|
||||
@@ -0,0 +1,8 @@
|
||||
import { FunctionComponent } from 'preact'
|
||||
|
||||
type Props = {
|
||||
classes?: string
|
||||
}
|
||||
export const PreferencesSegment: FunctionComponent<Props> = ({ children, classes = '' }) => (
|
||||
<div className={`flex flex-col ${classes}`}>{children}</div>
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './Content'
|
||||
export * from './MenuItem'
|
||||
export * from './PreferencesPane'
|
||||
export * from './PreferencesGroup'
|
||||
export * from './PreferencesSegment'
|
||||
Reference in New Issue
Block a user