-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update table to properly render actions/children
- Loading branch information
1 parent
115e8fe
commit b1ea88e
Showing
3 changed files
with
120 additions
and
140 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
29 changes: 12 additions & 17 deletions
29
packages/big-design/src/components/Table/Actions/Actions.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 |
---|---|---|
@@ -1,23 +1,18 @@ | ||
import React from 'react'; | ||
import React, { useContext } from 'react'; | ||
|
||
import { FlexProps } from '../../Flex'; | ||
import { TableContext } from '../context'; | ||
|
||
import { StyledActions } from './styled'; | ||
|
||
export interface TableActionsProps extends FlexProps { | ||
selectable?: boolean; | ||
tableId?: string; | ||
} | ||
export type TableActionsProps = FlexProps; | ||
|
||
export const TableActions: React.FC<TableActionsProps> = ({ | ||
children, | ||
className, | ||
selectable, | ||
style, | ||
tableId, | ||
...props | ||
}) => ( | ||
<StyledActions padding="small" aria-controls={tableId} {...props}> | ||
{children} | ||
</StyledActions> | ||
); | ||
export const TableActions: React.FC<TableActionsProps> = ({ children, className, style, ...props }) => { | ||
const tableContext = useContext(TableContext); | ||
|
||
return ( | ||
<StyledActions padding="small" aria-controls={tableContext.tableId} {...props}> | ||
{children} | ||
</StyledActions> | ||
); | ||
}; |
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