Refactor and Renaming some UI Props

This commit is contained in:
Bel Curcio 2021-06-04 11:45:13 -03:00
parent 3e0a185f84
commit fe324696d7
12 changed files with 37 additions and 18 deletions

View File

@ -1,14 +1,19 @@
import cn from 'classnames' import cn from 'classnames'
import React, { FC } from 'react' import React, { FC } from 'react'
interface Props { interface ContainerProps {
className?: string className?: string
children?: any children?: any
el?: HTMLElement el?: HTMLElement
clean?: boolean clean?: boolean
} }
const Container: FC<Props> = ({ children, className, el = 'div', clean }) => { const Container: FC<ContainerProps> = ({
children,
className,
el = 'div',
clean,
}) => {
const rootClassName = cn(className, { const rootClassName = cn(className, {
'mx-auto max-w-8xl px-6': !clean, 'mx-auto max-w-8xl px-6': !clean,
}) })

View File

@ -2,14 +2,14 @@ import cn from 'classnames'
import { FC, ReactNode, Component } from 'react' import { FC, ReactNode, Component } from 'react'
import s from './Grid.module.css' import s from './Grid.module.css'
interface Props { interface GridProps {
className?: string className?: string
children?: ReactNode[] | Component[] | any[] children?: ReactNode[] | Component[] | any[]
layout?: 'A' | 'B' | 'C' | 'D' | 'normal' layout?: 'A' | 'B' | 'C' | 'D' | 'normal'
variant?: 'default' | 'filled' variant?: 'default' | 'filled'
} }
const Grid: FC<Props> = ({ const Grid: FC<GridProps> = ({
className, className,
layout = 'A', layout = 'A',
children, children,

View File

@ -3,13 +3,13 @@ import { Container } from '@components/ui'
import { RightArrow } from '@components/icons' import { RightArrow } from '@components/icons'
import s from './Hero.module.css' import s from './Hero.module.css'
import Link from 'next/link' import Link from 'next/link'
interface Props { interface HeroProps {
className?: string className?: string
headline: string headline: string
description: string description: string
} }
const Hero: FC<Props> = ({ headline, description }) => { const Hero: FC<HeroProps> = ({ headline, description }) => {
return ( return (
<div className="bg-black"> <div className="bg-black">
<Container> <Container>

View File

@ -2,12 +2,12 @@ import cn from 'classnames'
import s from './Input.module.css' import s from './Input.module.css'
import React, { InputHTMLAttributes } from 'react' import React, { InputHTMLAttributes } from 'react'
export interface Props extends InputHTMLAttributes<HTMLInputElement> { export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
className?: string className?: string
onChange?: (...args: any[]) => any onChange?: (...args: any[]) => any
} }
const Input: React.FC<Props> = (props) => { const Input: React.FC<InputProps> = (props) => {
const { className, children, onChange, ...rest } = props const { className, children, onChange, ...rest } = props
const rootClassName = cn(s.root, {}, className) const rootClassName = cn(s.root, {}, className)

View File

@ -3,13 +3,13 @@ import s from './Marquee.module.css'
import { FC, ReactNode, Component } from 'react' import { FC, ReactNode, Component } from 'react'
import Ticker from 'react-ticker' import Ticker from 'react-ticker'
interface Props { interface MarqueeProps {
className?: string className?: string
children?: ReactNode[] | Component[] | any[] children?: ReactNode[] | Component[] | any[]
variant?: 'primary' | 'secondary' variant?: 'primary' | 'secondary'
} }
const Marquee: FC<Props> = ({ const Marquee: FC<MarqueeProps> = ({
className = '', className = '',
children, children,
variant = 'primary', variant = 'primary',

View File

@ -8,7 +8,7 @@ import {
clearAllBodyScrollLocks, clearAllBodyScrollLocks,
} from 'body-scroll-lock' } from 'body-scroll-lock'
import FocusTrap from '@lib/focus-trap' import FocusTrap from '@lib/focus-trap'
interface Props { interface ModalProps {
className?: string className?: string
children?: any children?: any
open?: boolean open?: boolean
@ -16,7 +16,7 @@ interface Props {
onEnter?: () => void | null onEnter?: () => void | null
} }
const Modal: FC<Props> = ({ children, open, onClose, onEnter = null }) => { const Modal: FC<ModalProps> = ({ children, open, onClose, onEnter = null }) => {
const ref = useRef() as React.MutableRefObject<HTMLDivElement> const ref = useRef() as React.MutableRefObject<HTMLDivElement>
const handleKey = useCallback( const handleKey = useCallback(

View File

@ -0,0 +1,2 @@
.root {
}

View File

@ -0,0 +1,10 @@
import React, { FC } from 'react'
import s from './Quantifier.module.css'
export interface QuantifierProps {}
const Quantifier: FC<QuantifierProps> = ({}) => {
return <div></div>
}
export default Quantifier

View File

@ -0,0 +1,2 @@
export { default } from './Quantifier'
export * from './Quantifier'

View File

@ -7,13 +7,13 @@ import {
clearAllBodyScrollLocks, clearAllBodyScrollLocks,
} from 'body-scroll-lock' } from 'body-scroll-lock'
interface Props { interface SidebarProps {
children: any children: any
open: boolean open: boolean
onClose: () => void onClose: () => void
} }
const Sidebar: FC<Props> = ({ children, open = false, onClose }) => { const Sidebar: FC<SidebarProps> = ({ children, open = false, onClose }) => {
const ref = useRef() as React.MutableRefObject<HTMLDivElement> const ref = useRef() as React.MutableRefObject<HTMLDivElement>
useEffect(() => { useEffect(() => {

View File

@ -3,7 +3,7 @@ import cn from 'classnames'
import px from '@lib/to-pixels' import px from '@lib/to-pixels'
import s from './Skeleton.module.css' import s from './Skeleton.module.css'
interface Props { interface SkeletonProps {
width?: string | number width?: string | number
height?: string | number height?: string | number
boxHeight?: string | number boxHeight?: string | number
@ -13,7 +13,7 @@ interface Props {
className?: string className?: string
} }
const Skeleton: React.FC<Props> = ({ const Skeleton: React.FC<SkeletonProps> = ({
style, style,
width, width,
height, height,

View File

@ -6,7 +6,7 @@ import React, {
import cn from 'classnames' import cn from 'classnames'
import s from './Text.module.css' import s from './Text.module.css'
interface Props { interface TextProps {
variant?: Variant variant?: Variant
className?: string className?: string
style?: CSSProperties style?: CSSProperties
@ -17,7 +17,7 @@ interface Props {
type Variant = 'heading' | 'body' | 'pageHeading' | 'sectionHeading' type Variant = 'heading' | 'body' | 'pageHeading' | 'sectionHeading'
const Text: FunctionComponent<Props> = ({ const Text: FunctionComponent<TextProps> = ({
style, style,
className = '', className = '',
variant = 'body', variant = 'body',