-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: the Badge component should be default act like an “inline” compo…
…nent Fixing some typescript misses and adding utility table components to make it easier to remember how to correctly style around badge/button components in a table
- Loading branch information
Showing
13 changed files
with
117 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* DO NOT EDIT: This file is generated in the post-build step of @tablecheck/tablekit-core | ||
* If you need to provide more "structure" to this component move it to the 'structuredComponents' folder | ||
*/ | ||
import { toggle } from '@tablecheck/tablekit-core'; | ||
import * as React from 'react'; | ||
|
||
import { getConfigDefault } from '../config'; | ||
|
||
export type Props = toggle.DefaultedProps & | ||
React.InputHTMLAttributes<HTMLInputElement>; | ||
|
||
export const Toggle = React.forwardRef< | ||
HTMLInputElement, | ||
Props & React.InputHTMLAttributes<HTMLInputElement> | ||
>((props, ref) => ( | ||
<input | ||
{...props} | ||
className={`${props.className ?? ''} toggle`} | ||
type={props.type ?? (toggle.defaultProps.type as never)} | ||
data-size={props['data-size'] ?? getConfigDefault('controlSize')} | ||
ref={ref} | ||
/> | ||
)); | ||
Toggle.displayName = `Toggle`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
system/react-css/src/structuredComponents/TableBadgeCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react'; | ||
|
||
export type Props = React.InputHTMLAttributes<HTMLTableCellElement>; | ||
|
||
/** | ||
* A utility component that attaches a `data-cell-type="badge"` attribute to a `td` element. | ||
*/ | ||
export const TableBadgeCell = React.forwardRef< | ||
HTMLTableCellElement, | ||
Props & React.HTMLAttributes<HTMLTableCellElement> | ||
>((props, ref) => <td {...props} data-cell-type="badge" ref={ref} />); | ||
TableBadgeCell.displayName = 'TableBadgeCell'; |
12 changes: 12 additions & 0 deletions
12
system/react-css/src/structuredComponents/TableButtonCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react'; | ||
|
||
export type Props = React.InputHTMLAttributes<HTMLTableCellElement>; | ||
|
||
/** | ||
* A utility component that attaches a `data-cell-type="button"` attribute to a `td` element. | ||
*/ | ||
export const TableButtonCell = React.forwardRef< | ||
HTMLTableCellElement, | ||
Props & React.HTMLAttributes<HTMLTableCellElement> | ||
>((props, ref) => <td {...props} data-cell-type="button" ref={ref} />); | ||
TableButtonCell.displayName = 'TableButtonCell'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react'; | ||
|
||
export type Props = React.InputHTMLAttributes<HTMLTableCellElement>; | ||
|
||
/** | ||
* A utility component that attaches a `data-cell-type="badge"` attribute to a `td` element. | ||
*/ | ||
export const TableBadgeCell = React.forwardRef< | ||
HTMLTableCellElement, | ||
Props & React.HTMLAttributes<HTMLTableCellElement> | ||
>((props, ref) => <td {...props} data-cell-type="badge" ref={ref} />); | ||
TableBadgeCell.displayName = 'TableBadgeCell'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react'; | ||
|
||
export type Props = React.InputHTMLAttributes<HTMLTableCellElement>; | ||
|
||
/** | ||
* A utility component that attaches a `data-cell-type="button"` attribute to a `td` element. | ||
*/ | ||
export const TableButtonCell = React.forwardRef< | ||
HTMLTableCellElement, | ||
Props & React.HTMLAttributes<HTMLTableCellElement> | ||
>((props, ref) => <td {...props} data-cell-type="button" ref={ref} />); | ||
TableButtonCell.displayName = 'TableButtonCell'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters