-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fluid-text-input): adds skeleton variant (#12151)
* feat(fluid-text-input): adds skeleton variant * chore(fluid-text-input): update snapshots
- Loading branch information
Showing
7 changed files
with
85 additions
and
1 deletion.
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
39 changes: 39 additions & 0 deletions
39
packages/react/src/components/FluidTextInput/FluidTextInput.Skeleton.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,39 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2018 | ||
* | ||
* 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 PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { usePrefix } from '../../internal/usePrefix'; | ||
import { FormContext } from '../FluidForm/FormContext'; | ||
|
||
function FluidTextInputSkeleton({ className, ...other }) { | ||
const prefix = usePrefix(); | ||
|
||
return ( | ||
<FormContext.Provider value={{ isFluid: true }}> | ||
<div | ||
className={classnames( | ||
`${prefix}--form-item ${prefix}--text-input--fluid__skeleton`, | ||
className | ||
)} | ||
{...other}> | ||
<span className={`${prefix}--label ${prefix}--skeleton`} /> | ||
<div className={`${prefix}--skeleton ${prefix}--text-input`} /> | ||
</div> | ||
</FormContext.Provider> | ||
); | ||
} | ||
|
||
FluidTextInputSkeleton.propTypes = { | ||
/** | ||
* Specify an optional className to be applied to the outer FluidForm wrapper | ||
*/ | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default FluidTextInputSkeleton; |
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