diff --git a/README.md b/README.md index 40a6e5160..9b27eb8e6 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,6 @@ yarn add @logicalclocks/quartz ### Usage ```tsx -import React from 'react'; - import { ThemeProvider, Button } from '@logicalclocks/quartz'; const App = () => ( @@ -103,10 +101,9 @@ Delete `node_modules` and `dist` folders then follow **Build locally** or **Run Follow **Build locally** or **Run locally** instruction - ## Using locally + You can use the library locally with the help of [yalc](https://github.com/wclr/yalc). Just run `yarn publish-local` here and then do a `yalc link @logicalclocks/quartz` wherever you wanna use it. To publish changes you can do `yarn dlx yalc push`. After that, the changes will be "published" to the local registry. - diff --git a/src/components/alternative-header/AlternativeHeader.tsx b/src/components/alternative-header/AlternativeHeader.tsx index a4a432249..b88222047 100644 --- a/src/components/alternative-header/AlternativeHeader.tsx +++ b/src/components/alternative-header/AlternativeHeader.tsx @@ -1,4 +1,4 @@ -import React, { FC, useMemo } from 'react'; +import React, { useMemo } from 'react'; import { Box, BoxProps, Flex } from 'rebass'; import Value from '../typography/value'; import * as S from './styles'; @@ -23,7 +23,7 @@ export interface Props extends Omit { withBase?: boolean; } -export const AlternativeHeader: FC = ({ +export const AlternativeHeader = ({ title, tabs, withBase = false, diff --git a/src/components/alternative-header/stories.tsx b/src/components/alternative-header/stories.tsx index 9dca3c7c5..e718fd665 100644 --- a/src/components/alternative-header/stories.tsx +++ b/src/components/alternative-header/stories.tsx @@ -1,5 +1,5 @@ import { Meta, StoryObj } from '@storybook/react'; -import React, { useMemo, useState } from 'react'; +import { useMemo, useState } from 'react'; import { Box } from 'rebass'; import { AlternativeHeader } from './index'; diff --git a/src/components/animated-progress/AnimatedProgress.tsx b/src/components/animated-progress/AnimatedProgress.tsx index 6e2436eac..098b6e4bb 100644 --- a/src/components/animated-progress/AnimatedProgress.tsx +++ b/src/components/animated-progress/AnimatedProgress.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { useNProgress } from '@tanem/react-nprogress'; import { Options } from '@tanem/react-nprogress/dist/types'; diff --git a/src/components/animated-progress/Bar.tsx b/src/components/animated-progress/Bar.tsx index 7a7d1ad91..be7bce928 100644 --- a/src/components/animated-progress/Bar.tsx +++ b/src/components/animated-progress/Bar.tsx @@ -1,11 +1,11 @@ -import React from 'react'; import { Flex } from 'rebass'; -const Bar: React.FC<{ +interface Props { animationDuration: number; progress: number; variant: string; -}> = ({ animationDuration, progress, variant }) => ( +} +const Bar = ({ animationDuration, progress, variant }: Props) => ( ( diff --git a/src/components/animated-progress/stories.tsx b/src/components/animated-progress/stories.tsx index 1d466a1fb..0b2b7141e 100644 --- a/src/components/animated-progress/stories.tsx +++ b/src/components/animated-progress/stories.tsx @@ -1,5 +1,5 @@ import { Meta, StoryObj } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { Box } from '../box'; import { Button } from '../button'; import { Flex } from '../flex'; diff --git a/src/components/badge/Badge.tsx b/src/components/badge/Badge.tsx index 17ba8e375..e2e72afe4 100644 --- a/src/components/badge/Badge.tsx +++ b/src/components/badge/Badge.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Flex, FlexProps, SxStyleProp } from 'rebass'; import { useTheme } from '../../theme/theme'; import { getIcon, IconName } from '../icon/list'; diff --git a/src/components/badge/stories.tsx b/src/components/badge/stories.tsx index 65be0bc4e..e7c5c6278 100644 --- a/src/components/badge/stories.tsx +++ b/src/components/badge/stories.tsx @@ -1,5 +1,4 @@ import { Meta, StoryObj } from '@storybook/react'; -import React from 'react'; import { Badge } from './Badge'; import { IconName } from '../icon/list'; diff --git a/src/components/bar/Bar.tsx b/src/components/bar/Bar.tsx index 6785beefc..e191552e0 100644 --- a/src/components/bar/Bar.tsx +++ b/src/components/bar/Bar.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import * as R from 'ramda'; import { Box, BoxProps } from '../box'; diff --git a/src/components/bar/stories.tsx b/src/components/bar/stories.tsx index 65bea4e76..fbcf562f9 100644 --- a/src/components/bar/stories.tsx +++ b/src/components/bar/stories.tsx @@ -1,5 +1,4 @@ import { Meta, StoryObj } from '@storybook/react'; -import React from 'react'; import { Flex } from '../flex'; import { Bar } from './Bar'; diff --git a/src/components/box/Box.tsx b/src/components/box/Box.tsx index 5068f8100..39e723e4d 100644 --- a/src/components/box/Box.tsx +++ b/src/components/box/Box.tsx @@ -1,10 +1,12 @@ -import React, { FC, forwardRef } from 'react'; +import { PropsWithChildren, forwardRef } from 'react'; import { Box as RebassBox, BoxProps } from 'rebass'; export interface Props extends Omit {} -export const Box: FC = forwardRef(({ children, ...rest }, ref) => ( - - {children} - -)); +export const Box = forwardRef( + ({ children, ...rest }: PropsWithChildren, ref) => ( + + {children} + + ), +); diff --git a/src/components/button/Button.tsx b/src/components/button/Button.tsx index bcbe701b5..d5a5d9591 100644 --- a/src/components/button/Button.tsx +++ b/src/components/button/Button.tsx @@ -1,5 +1,4 @@ import * as R from 'ramda'; -import React from 'react'; import { Button as RebassButton, ButtonProps } from 'rebass'; // Styles diff --git a/src/components/button/stories.tsx b/src/components/button/stories.tsx index c9ca1e84d..2610eb0e8 100644 --- a/src/components/button/stories.tsx +++ b/src/components/button/stories.tsx @@ -1,5 +1,4 @@ import { action } from '@storybook/addon-actions'; -import React from 'react'; import { StoryObj, Meta } from '@storybook/react'; import { Button } from './Button'; diff --git a/src/components/callout/index.tsx b/src/components/callout/index.tsx index 256cb00d7..472b10c4e 100644 --- a/src/components/callout/index.tsx +++ b/src/components/callout/index.tsx @@ -1,4 +1,3 @@ -import React, { FC } from 'react'; import { Box, Flex, FlexProps, Text } from 'rebass'; import styles from './callout.styles'; import { Color } from '../../theme/types'; @@ -23,12 +22,7 @@ export interface ICalloutProps extends Omit { cta?: React.ReactNode; } -const Callout: FC = ({ - type, - content, - cta, - ...props -}: ICalloutProps) => ( +const Callout = ({ type, content, cta, ...props }: ICalloutProps) => ( = ({ +const CalloutWithButton = ({ buttonContent, content, onClick, diff --git a/src/components/card-header/index.tsx b/src/components/card-header/index.tsx index 0157f8974..f4d2789f8 100644 --- a/src/components/card-header/index.tsx +++ b/src/components/card-header/index.tsx @@ -1,4 +1,3 @@ -import React, { FC } from 'react'; import { Box, BoxProps, Flex } from 'rebass'; import styles from './card-header.styles'; @@ -8,13 +7,13 @@ export interface CardHeaderProps extends Omit { withShadow?: boolean; withBorderBottom?: boolean; } -const CardHeader: FC = ({ +const CardHeader = ({ title, actions, withShadow = false, withBorderBottom = false, ...props -}) => ( +}: CardHeaderProps) => ( {title && ( diff --git a/src/components/card-header/stories.tsx b/src/components/card-header/stories.tsx index d8568ca6e..c5f7daa5d 100644 --- a/src/components/card-header/stories.tsx +++ b/src/components/card-header/stories.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { action } from '@storybook/addon-actions'; import { Box, Button } from 'rebass'; diff --git a/src/components/card/card-secondary.tsx b/src/components/card/card-secondary.tsx index 2dfb7f639..527b2f6d5 100644 --- a/src/components/card/card-secondary.tsx +++ b/src/components/card/card-secondary.tsx @@ -1,4 +1,4 @@ -import React, { FC, memo, useEffect, useRef, useState } from 'react'; +import { memo, useEffect, useRef, useState } from 'react'; import { Box, Flex, @@ -18,7 +18,7 @@ export interface CardSecondaryProps readonly?: boolean; } -const CardSecondary: FC = ({ +const CardSecondary = ({ title, children, maxHeight, diff --git a/src/components/card/index.tsx b/src/components/card/index.tsx index 8bf79e669..1571ece81 100644 --- a/src/components/card/index.tsx +++ b/src/components/card/index.tsx @@ -1,4 +1,4 @@ -import React, { FC, memo, useRef } from 'react'; +import { memo, useRef } from 'react'; import { Box, Card as RebassCard, CardProps as RebassCardProps } from 'rebass'; // Styles @@ -20,7 +20,7 @@ export interface CardProps extends Omit { expandable?: boolean; } -const Card: FC = ({ +const Card = ({ title, actions, children, diff --git a/src/components/card/stories.tsx b/src/components/card/stories.tsx index 47ff1c115..e9984ecef 100644 --- a/src/components/card/stories.tsx +++ b/src/components/card/stories.tsx @@ -1,5 +1,4 @@ import { action } from '@storybook/addon-actions'; -import React from 'react'; import { Meta, StoryObj } from '@storybook/react'; import Card from '.'; diff --git a/src/components/checkbox/checkbox-group.tsx b/src/components/checkbox/checkbox-group.tsx index 99b903e75..f3cdccb72 100644 --- a/src/components/checkbox/checkbox-group.tsx +++ b/src/components/checkbox/checkbox-group.tsx @@ -1,6 +1,5 @@ -import React, { FC, useCallback } from 'react'; +import { useCallback } from 'react'; -// Components import Label, { LabelProps } from '../label'; import Checkbox from './index'; import { TooltipProps } from '../tooltip'; @@ -15,7 +14,7 @@ export interface CheckboxGroupProps tooltipProps?: Omit; } -const CheckboxGroup: FC = ({ +const CheckboxGroup = ({ label, options, value, diff --git a/src/components/checkbox/group.stories.tsx b/src/components/checkbox/group.stories.tsx index 5c5b26bda..a5832f967 100644 --- a/src/components/checkbox/group.stories.tsx +++ b/src/components/checkbox/group.stories.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import { useState } from 'react'; import { Meta, StoryObj } from '@storybook/react'; import CheckboxGroup from './checkbox-group'; diff --git a/src/components/checkbox/index.tsx b/src/components/checkbox/index.tsx index 718cf4e4a..972ad5c2b 100644 --- a/src/components/checkbox/index.tsx +++ b/src/components/checkbox/index.tsx @@ -1,10 +1,8 @@ import { CheckboxProps as RebassCheckboxProps } from '@rebass/forms'; -import React, { FC, forwardRef } from 'react'; +import { forwardRef } from 'react'; import { Box, Flex } from 'rebass'; -// Components import Labeling from '../typography/labeling'; -// Styles import styles from './checkbox-styles'; import Tooltip, { TooltipProps } from '../tooltip'; @@ -14,7 +12,7 @@ export interface CheckboxProps extends Omit { tooltipProps?: Omit; } -const Checkbox: FC = forwardRef( +const Checkbox = forwardRef( ( { label, diff --git a/src/components/checkbox/stories.tsx b/src/components/checkbox/stories.tsx index aaed8fbce..baf95cb6a 100644 --- a/src/components/checkbox/stories.tsx +++ b/src/components/checkbox/stories.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Meta, StoryObj } from '@storybook/react'; import Checkbox from './index'; diff --git a/src/components/code-input/index.tsx b/src/components/code-input/index.tsx index d6b884b92..39ff7d385 100644 --- a/src/components/code-input/index.tsx +++ b/src/components/code-input/index.tsx @@ -1,4 +1,4 @@ -import React, { FC, forwardRef } from 'react'; +import { forwardRef } from 'react'; import { Box, Flex } from 'rebass'; import { loadLanguage } from '@uiw/codemirror-extensions-langs'; @@ -31,7 +31,7 @@ export interface CodeInputProps intent?: Intents; } -const CodeInput: FC = forwardRef( +const CodeInput = forwardRef( ({ label = '', value, diff --git a/src/components/code-input/stories.tsx b/src/components/code-input/stories.tsx index 2867158ae..6c83e20f6 100644 --- a/src/components/code-input/stories.tsx +++ b/src/components/code-input/stories.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryObj } from '@storybook/react'; -import React from 'react'; import CodeInput from '.'; diff --git a/src/components/code/code.styles.ts b/src/components/code/code.styles.ts index 3ca55f404..bbe0a518e 100644 --- a/src/components/code/code.styles.ts +++ b/src/components/code/code.styles.ts @@ -1,5 +1,3 @@ -import React from 'react'; - export const boxStyles: React.CSSProperties = { width: '100%', lineHeight: '16px', diff --git a/src/components/code/index.tsx b/src/components/code/index.tsx index f53de2c4f..4db0dcb6b 100644 --- a/src/components/code/index.tsx +++ b/src/components/code/index.tsx @@ -1,5 +1,5 @@ import { EditorView } from '@codemirror/view'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { Box, Flex, FlexProps } from 'rebass'; import { LanguageName, loadLanguage } from '@uiw/codemirror-extensions-langs'; diff --git a/src/components/code/stories.tsx b/src/components/code/stories.tsx index 30ccabc2a..7040c8b7d 100644 --- a/src/components/code/stories.tsx +++ b/src/components/code/stories.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { StoryObj, Meta } from '@storybook/react'; import { Box } from 'rebass'; import Code, { defaultPopupProps } from './index'; diff --git a/src/components/collapse/index.tsx b/src/components/collapse/index.tsx index 632a8c86f..edf65a76b 100644 --- a/src/components/collapse/index.tsx +++ b/src/components/collapse/index.tsx @@ -1,5 +1,5 @@ +import { memo, useEffect, useRef, useState } from 'react'; import { Box, BoxProps, Flex } from 'rebass'; -import React, { FC, memo, useEffect, useRef, useState } from 'react'; import Labeling from '../typography/labeling'; import styles, { contentStyles, containerStyles } from './collapse.styles'; @@ -13,7 +13,7 @@ export interface CollapseProps extends Omit { openChange?: (value: boolean) => void; } -const Collapse: FC = ({ +const Collapse = ({ title, contentProps, secondaryContent, @@ -21,7 +21,7 @@ const Collapse: FC = ({ isOpenProps = false, openChange, ...props -}) => { +}: CollapseProps) => { const containerRef = useRef(null); const contentRef = useRef(null); diff --git a/src/components/collapse/stories.tsx b/src/components/collapse/stories.tsx index bd23fa859..a917e211a 100644 --- a/src/components/collapse/stories.tsx +++ b/src/components/collapse/stories.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Box } from 'rebass'; import { StoryObj, Meta } from '@storybook/react'; diff --git a/src/components/compact-button/compact-button.tsx b/src/components/compact-button/compact-button.tsx index a0131da1f..1f9c6ee60 100644 --- a/src/components/compact-button/compact-button.tsx +++ b/src/components/compact-button/compact-button.tsx @@ -1,4 +1,4 @@ -import React, { FC, memo, CSSProperties } from 'react'; +import { memo, CSSProperties } from 'react'; import { Button, ButtonProps, Flex, Box } from 'rebass'; import { GetIcon, IconName } from '../icon'; @@ -30,7 +30,7 @@ const getLinkProps = ({ href, newTab }: LinkRelatedProps): Partial => } : {}; -const CompactButton: FC = ({ +const CompactButton = ({ icon, href, children, @@ -40,7 +40,7 @@ const CompactButton: FC = ({ newTab = false, mode = 'default', ...props -}) => ( +}: Props) => (