From 97e5e52cace900a3139b5e4ec092aa31adf7a5df Mon Sep 17 00:00:00 2001 From: Conner Davis Date: Sat, 30 Jul 2022 15:26:06 -0700 Subject: [PATCH 1/4] fix(config): undo ignore `src/{docs,lib}` with `prettier` `.prettierignore` was misconfigured to ignore these folders, which contain the vast majority of the source files. --- .prettierignore | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.prettierignore b/.prettierignore index 17b0db15e..d41b9248a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,8 @@ -*.md -.gitignore -build/ -coverage/ +**/*.md +**/build/ +**/coverage/ +docs/ lib/ -docs/ \ No newline at end of file + +!src/docs/ +!src/lib/ From ee6344f1cd4cc4e4f9af91f4293af0fce58944bd Mon Sep 17 00:00:00 2001 From: Conner Davis Date: Sat, 30 Jul 2022 15:26:26 -0700 Subject: [PATCH 2/4] chore(format): format with `prettier` --- src/lib/components/Carousel/index.tsx | 12 +-- src/lib/components/Dropdown/index.tsx | 8 +- src/lib/components/Floating/index.tsx | 2 +- src/lib/components/Flowbite/FlowbiteTheme.ts | 16 +++- src/lib/components/Footer/FooterCopyright.tsx | 2 +- src/lib/components/Footer/FooterLink.tsx | 2 +- src/lib/components/Footer/FooterTitle.tsx | 2 +- src/lib/components/FormControls/Radio.tsx | 2 +- src/lib/components/FormControls/Select.tsx | 80 ++++++++----------- src/lib/components/FormControls/Textarea.tsx | 30 +++---- src/lib/components/Navbar/NavbarBrand.tsx | 4 +- src/lib/components/Navbar/NavbarCollapse.tsx | 4 +- src/lib/components/Navbar/NavbarLink.tsx | 13 +-- src/lib/components/Navbar/NavbarToggle.tsx | 7 +- src/lib/components/Navbar/index.tsx | 17 ++-- src/lib/components/Tooltip/index.tsx | 2 +- src/lib/helpers/floating.ts | 46 +++++------ src/lib/theme/default.ts | 60 +++++++------- 18 files changed, 153 insertions(+), 156 deletions(-) diff --git a/src/lib/components/Carousel/index.tsx b/src/lib/components/Carousel/index.tsx index 487bbd865..9a8a72a48 100644 --- a/src/lib/components/Carousel/index.tsx +++ b/src/lib/components/Carousel/index.tsx @@ -142,14 +142,14 @@ const DefaultLeftControl: FC = () => { - ) + ); }; const DefaultRightControl: FC = () => { const theme = useTheme().theme.carousel; return ( - - - - ) -}; \ No newline at end of file + + + + ); +}; diff --git a/src/lib/components/Dropdown/index.tsx b/src/lib/components/Dropdown/index.tsx index f0ef5d58f..56296810f 100644 --- a/src/lib/components/Dropdown/index.tsx +++ b/src/lib/components/Dropdown/index.tsx @@ -14,9 +14,9 @@ import { DropdownItem } from './DropdownItem'; export interface DropdownProps extends PropsWithChildren>, ButtonProps { label: ReactNode; inline?: boolean; - floatingArrow?: boolean; + floatingArrow?: boolean; arrowIcon?: boolean; -}; +} const icons: Record>> = { top: HiOutlineChevronUp, @@ -28,8 +28,8 @@ const icons: Record>> = { const DropdownComponent: FC = ({ children, ...props }) => { const theme = useTheme().theme.dropdown; const theirProps = excludeClassName(props) as DropdownProps; - const { - placement = props.inline ? 'bottom-start' : 'bottom', + const { + placement = props.inline ? 'bottom-start' : 'bottom', trigger = 'click', label, inline, diff --git a/src/lib/components/Floating/index.tsx b/src/lib/components/Floating/index.tsx index 7cc6394f6..edb837f89 100644 --- a/src/lib/components/Floating/index.tsx +++ b/src/lib/components/Floating/index.tsx @@ -143,4 +143,4 @@ export const Floating: FC = ({ ); -}; \ No newline at end of file +}; diff --git a/src/lib/components/Flowbite/FlowbiteTheme.ts b/src/lib/components/Flowbite/FlowbiteTheme.ts index daa34ba0d..ea6a5a6f7 100644 --- a/src/lib/components/Flowbite/FlowbiteTheme.ts +++ b/src/lib/components/Flowbite/FlowbiteTheme.ts @@ -11,7 +11,15 @@ import type { } from '../Button'; import type { PositionInButtonGroup } from '../Button/ButtonGroup'; import type { FlowbiteFloatingTheme } from '../Floating'; -import type { HelperColors, LabelColors, SelectColors, SelectSizes, TextareaColors, TextInputColors, TextInputSizes } from '../FormControls'; +import type { + HelperColors, + LabelColors, + SelectColors, + SelectSizes, + TextareaColors, + TextInputColors, + TextInputSizes, +} from '../FormControls'; import type { ModalPositions, ModalSizes } from '../Modal'; import type { ProgressColor, ProgressSizes } from '../Progress'; import type { StarSizes } from '../Rating'; @@ -147,10 +155,10 @@ export interface FlowbiteTheme { base: string; wrapper: string; }; - control:{ + control: { base: string; icon: string; - }, + }; leftControl: string; rightControl: string; scrollContainer: { @@ -470,7 +478,7 @@ export interface FlowbiteTheme { content: string; inlineWrapper: string; arrowIcon: string; - } + }; } export interface FlowbiteBoolean { diff --git a/src/lib/components/Footer/FooterCopyright.tsx b/src/lib/components/Footer/FooterCopyright.tsx index 0b644c603..d59549772 100644 --- a/src/lib/components/Footer/FooterCopyright.tsx +++ b/src/lib/components/Footer/FooterCopyright.tsx @@ -1,7 +1,7 @@ import type { ComponentProps, FC, PropsWithChildren } from 'react'; import { useTheme } from '../Flowbite/ThemeContext'; -export interface CopyrightProps extends Omit>,'className'> { +export interface CopyrightProps extends Omit>, 'className'> { href?: string; by: string; year?: number; diff --git a/src/lib/components/Footer/FooterLink.tsx b/src/lib/components/Footer/FooterLink.tsx index ea743cb79..b994e112b 100644 --- a/src/lib/components/Footer/FooterLink.tsx +++ b/src/lib/components/Footer/FooterLink.tsx @@ -1,7 +1,7 @@ import type { ComponentProps, FC, PropsWithChildren } from 'react'; import { useTheme } from '../Flowbite/ThemeContext'; -export interface FooterLinkProps extends Omit>,'className'>{ +export interface FooterLinkProps extends Omit>, 'className'> { href: string; } diff --git a/src/lib/components/Footer/FooterTitle.tsx b/src/lib/components/Footer/FooterTitle.tsx index a41d3212f..bab829a62 100644 --- a/src/lib/components/Footer/FooterTitle.tsx +++ b/src/lib/components/Footer/FooterTitle.tsx @@ -1,7 +1,7 @@ import type { ComponentProps, FC, PropsWithChildren } from 'react'; import { useTheme } from '../Flowbite/ThemeContext'; -export interface FooterTitleProps extends Omit>,'className'>{ +export interface FooterTitleProps extends Omit>, 'className'> { title: string; } diff --git a/src/lib/components/FormControls/Radio.tsx b/src/lib/components/FormControls/Radio.tsx index a4322cadf..8fc9ae99a 100644 --- a/src/lib/components/FormControls/Radio.tsx +++ b/src/lib/components/FormControls/Radio.tsx @@ -5,7 +5,7 @@ import { useTheme } from '../Flowbite/ThemeContext'; export type RadioProps = Omit, 'type' | 'className' | 'ref'>; -export const Radio = forwardRef ((props, ref) => { +export const Radio = forwardRef((props, ref) => { const theme = useTheme().theme.formControls.radio; const theirProps = excludeClassName(props); return ; diff --git a/src/lib/components/FormControls/Select.tsx b/src/lib/components/FormControls/Select.tsx index 3e1543a3c..81a4b9630 100644 --- a/src/lib/components/FormControls/Select.tsx +++ b/src/lib/components/FormControls/Select.tsx @@ -1,9 +1,8 @@ import classNames from 'classnames'; import type { ComponentProps, FC, ReactNode } from 'react'; -import {forwardRef} from 'react'; -import type { FlowbiteSizes } from '../Flowbite/FlowbiteTheme'; +import { forwardRef } from 'react'; import { excludeClassName } from '../../helpers/exclude'; -import type { FlowbiteColors } from '../Flowbite/FlowbiteTheme'; +import type { FlowbiteColors, FlowbiteSizes } from '../Flowbite/FlowbiteTheme'; import { useTheme } from '../Flowbite/ThemeContext'; import HelperText from './HelperText'; @@ -22,50 +21,39 @@ export interface SelectProps extends Omit, 'className' addon?: ReactNode; icon?: FC>; color?: keyof SelectColors; -}; +} -export const Select = forwardRef(({ - children, - sizing = 'md', - shadow, - helperText, - addon, - icon: Icon, - color = 'gray', - ...props -}, ref) => { - const theme = useTheme().theme.formControls.select; - const theirProps = excludeClassName(props); +export const Select = forwardRef( + ({ children, sizing = 'md', shadow, helperText, addon, icon: Icon, color = 'gray', ...props }, ref) => { + const theme = useTheme().theme.formControls.select; + const theirProps = excludeClassName(props); - return ( -
- {addon && ( - - {addon} - - )} -
- {Icon && ( -
- -
- )} - - {helperText && {helperText}} + + {helperText && {helperText}} +
- - ) -}); + ); + }, +); diff --git a/src/lib/components/FormControls/Textarea.tsx b/src/lib/components/FormControls/Textarea.tsx index 0d820340c..30aac2838 100644 --- a/src/lib/components/FormControls/Textarea.tsx +++ b/src/lib/components/FormControls/Textarea.tsx @@ -16,19 +16,21 @@ export interface TextareaProps extends Omit, 'classNa color?: keyof TextareaColors; } -export const Textarea = forwardRef(({ shadow, helperText, color = 'gray', ...props }, ref) => { - const theme = useTheme().theme.formControls.textarea; - const theirProps = excludeClassName(props) - return ( - <> -