-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Datagrid): add ai slug support to col headers (#4163)
* feat(Datagrid): start slug addition in col headers * feat(Datagrid): add column header slug support * chore: update initial widths * chore: revert copyright header change * chore: small refactor
- Loading branch information
1 parent
cc3061b
commit f0b17e2
Showing
7 changed files
with
357 additions
and
10 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
27 changes: 27 additions & 0 deletions
27
packages/ibm-products/src/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.js
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,27 @@ | ||
/** | ||
* Copyright IBM Corp. 2024, 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React, { forwardRef, isValidElement } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export const ColumnHeaderSlug = forwardRef(({ slug }, ref) => { | ||
if (slug && isValidElement(slug)) { | ||
const normalizedSlug = React.cloneElement(slug, { | ||
size: 'mini', | ||
ref, | ||
}); | ||
return normalizedSlug; | ||
} | ||
return; | ||
}); | ||
|
||
ColumnHeaderSlug.propTypes = { | ||
/** | ||
* Specify the AI slug to be displayed | ||
*/ | ||
slug: PropTypes.node, | ||
}; |
Oops, something went wrong.