Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Export conform for compound components #828

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/core-react/src/Accordion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { AccordionHeaderTitle } from './AccordionHeaderTitle'
import { AccordionPanel } from './AccordionPanel'
import type { AccordionProps as Props } from './Accordion.types'

type AllAccordionProps = typeof BaseAccordion & {
type AccordionCompoundProps = typeof BaseAccordion & {
AccordionItem: typeof AccordionItem
AccordionHeader: typeof AccordionHeader
AccordionHeaderTitle: typeof AccordionHeaderTitle
AccordionPanel: typeof AccordionPanel
}

const Accordion = BaseAccordion as AllAccordionProps
const Accordion = BaseAccordion as AccordionCompoundProps

Accordion.AccordionItem = AccordionItem
Accordion.AccordionHeader = AccordionHeader
Expand Down
9 changes: 5 additions & 4 deletions libraries/core-react/src/Banner/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { Banner as BaseBanner } from './Banner'
import { Banner as BaseBanner, BannerProps } from './Banner'
import { BannerIcon } from './BannerIcon'
import { BannerMessage } from './BannerMessage'
import { BannerActions } from './BannerActions'

type BannerProps = typeof BaseBanner & {
type BannerCompoundProps = typeof BaseBanner & {
BannerIcon: typeof BannerIcon
BannerMessage: typeof BannerMessage
BannerActions: typeof BannerActions
}

const Banner = BaseBanner as BannerProps
const Banner = BaseBanner as BannerCompoundProps

Banner.BannerIcon = BannerIcon
Banner.BannerMessage = BannerMessage
Banner.BannerActions = BannerActions

export { Banner, BannerProps }
export { Banner }
export type { BannerProps }
9 changes: 5 additions & 4 deletions libraries/core-react/src/Breadcrumbs/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Breadcrumbs as BaseComponent } from './Breadcrumbs'
import { Breadcrumbs as BaseComponent, BreadcrumbsProps } from './Breadcrumbs'
import { Breadcrumb } from './Breadcrumb'

type BreadcrumbsProps = typeof BaseComponent & {
type BreadcrumbsCompoundProps = typeof BaseComponent & {
Breadcrumb: typeof Breadcrumb
}

const Breadcrumbs = BaseComponent as BreadcrumbsProps
const Breadcrumbs = BaseComponent as BreadcrumbsCompoundProps

Breadcrumbs.Breadcrumb = Breadcrumb

export { Breadcrumbs, BreadcrumbsProps }
export { Breadcrumbs }
export type { BreadcrumbsProps }
9 changes: 5 additions & 4 deletions libraries/core-react/src/Card/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { Card as CardWrapper } from './Card'
import { Card as CardWrapper, CardProps } from './Card'
import { CardActions } from './CardActions'
import { CardMedia } from './CardMedia'
import { CardHeader } from './CardHeader'
import { CardHeaderTitle } from './CardHeaderTitle'

type CardProps = typeof CardWrapper & {
type CardCompoundProps = typeof CardWrapper & {
CardActions: typeof CardActions
CardHeader: typeof CardHeader
CardMedia: typeof CardMedia
CardHeaderTitle: typeof CardHeaderTitle
}

const Card = CardWrapper as CardProps
const Card = CardWrapper as CardCompoundProps

Card.CardActions = CardActions
Card.CardHeader = CardHeader
Card.CardMedia = CardMedia
Card.CardHeaderTitle = CardHeaderTitle

export { Card, CardProps }
export { Card }
export type { CardProps }
9 changes: 5 additions & 4 deletions libraries/core-react/src/List/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { List as BaseComponent } from './List'
import { List as BaseComponent, ListProps } from './List'
import { ListItem } from './ListItem'

type ListProps = typeof BaseComponent & {
type ListCompoundProps = typeof BaseComponent & {
ListItem: typeof ListItem
}

const List = BaseComponent as ListProps
const List = BaseComponent as ListCompoundProps

List.ListItem = ListItem

export { List, ListProps }
export { List }
export type { ListProps }
9 changes: 5 additions & 4 deletions libraries/core-react/src/Popover/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { Popover as BaseComponent } from './Popover'
import { Popover as BaseComponent, PopoverProps } from './Popover'
import { PopoverTitle } from './PopoverTitle'
import { PopoverAnchor } from './PopoverAnchor'
import { PopoverContent } from './PopoverContent'

type PopoverProps = typeof BaseComponent & {
type PopoverConformProps = typeof BaseComponent & {
PopoverTitle: typeof PopoverTitle
PopoverAnchor: typeof PopoverAnchor
PopoverContent: typeof PopoverContent
}

const Popover = BaseComponent as PopoverProps
const Popover = BaseComponent as PopoverConformProps

Popover.PopoverTitle = PopoverTitle
Popover.PopoverAnchor = PopoverAnchor
Popover.PopoverContent = PopoverContent

export { Popover, PopoverProps }
export { Popover }
export type { PopoverProps }
7 changes: 5 additions & 2 deletions libraries/core-react/src/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ const TableBase = styled.table`
border-collapse: collapse;
`

type Props = HTMLAttributes<HTMLTableElement>
export type TableProps = HTMLAttributes<HTMLTableElement>

export const Table: FunctionComponent<Props> = ({ children, ...props }) => {
export const Table: FunctionComponent<TableProps> = ({
children,
...props
}) => {
return <TableBase {...props}>{children}</TableBase>
}

Expand Down
9 changes: 5 additions & 4 deletions libraries/core-react/src/Table/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { Table as BaseComponent } from './Table'
import { Table as BaseComponent, TableProps } from './Table'
import { Body } from './Body'
import { Cell } from './Cell'
import { Head } from './Head'
import { Row } from './Row'

type TableProps = typeof BaseComponent & {
type TableCompoundProps = typeof BaseComponent & {
Body: typeof Body
Cell: typeof Cell
Head: typeof Head
Row: typeof Row
}

const Table = BaseComponent as TableProps
const Table = BaseComponent as TableCompoundProps

Table.Body = Body
Table.Cell = Cell
Table.Head = Head
Table.Row = Row

export { Table, TableProps }
export { Table }
export type { TableProps }
12 changes: 8 additions & 4 deletions libraries/core-react/src/TableOfContents/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { TableOfContents as BaseComponent } from './TableOfContents'
import {
TableOfContents as BaseComponent,
TableOfContentsProps,
} from './TableOfContents'
import { LinkItem } from './LinkItem'

type TableOfContentsProps = typeof BaseComponent & {
type TableOfContentsCompoundProps = typeof BaseComponent & {
LinkItem: typeof LinkItem
}

const TableOfContents = BaseComponent as TableOfContentsProps
const TableOfContents = BaseComponent as TableOfContentsCompoundProps

TableOfContents.LinkItem = LinkItem

export { TableOfContents, TableOfContentsProps }
export { TableOfContents }
export type { TableOfContentsProps }
4 changes: 2 additions & 2 deletions libraries/core-react/src/Tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { Tab } from './Tab'
import { TabPanels } from './TabPanels'
import { TabPanel } from './TabPanel'

type TabsType = typeof BaseComponent & {
type TabsCompoundProps = typeof BaseComponent & {
Tab: typeof Tab
TabList: typeof TabList
TabPanels: typeof TabPanels
TabPanel: typeof TabPanel
}

const Tabs = BaseComponent as TabsType
const Tabs = BaseComponent as TabsCompoundProps

Tabs.Tab = Tab
Tabs.TabList = TabList
Expand Down
9 changes: 5 additions & 4 deletions libraries/core-react/src/TopBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { TopBar as BaseComponent } from './TopBar'
import { TopBar as BaseComponent, TopbarProps } from './TopBar'
import { Actions } from './Actions'
import { Header } from './Header'
import { CustomContent } from './CustomContent'

type TopbarProps = typeof BaseComponent & {
type TopbarCompoundProps = typeof BaseComponent & {
Actions: typeof Actions
Header: typeof Header
CustomContent: typeof CustomContent
}

const TopBar = BaseComponent as TopbarProps
const TopBar = BaseComponent as TopbarCompoundProps

TopBar.Actions = Actions
TopBar.Header = Header
TopBar.CustomContent = CustomContent

export { TopBar, TopbarProps }
export { TopBar }
export type { TopbarProps }