Skip to content

Commit

Permalink
fix: added hideLabel to dropdown family
Browse files Browse the repository at this point in the history
  • Loading branch information
guidari committed Mar 5, 2024
1 parent 8ca4780 commit 7427e94
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2990,6 +2990,9 @@ Map {
"className": Object {
"type": "string",
},
"hideLabel": Object {
"type": "bool",
},
"size": Object {
"args": Array [
Array [
Expand Down
23 changes: 22 additions & 1 deletion packages/react/src/components/Dropdown/Dropdown.Skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,26 @@ import { usePrefix } from '../../internal/usePrefix';
import { ReactAttr } from '../../types/common';

export interface DropdownSkeletonProps extends ReactAttr<HTMLDivElement> {
/**
* Specify an optional className to add.
*/
className?: string;

/**
* Specify whether the label should be hidden, or not
*/
hideLabel?: boolean;

/**
* Specify the size of the ListBox.
*/
size?: ListBoxSize;
}

const DropdownSkeleton: React.FC<DropdownSkeletonProps> = ({
className,
size,
hideLabel,
...rest
}: DropdownSkeletonProps) => {
const prefix = usePrefix();
Expand All @@ -36,7 +50,9 @@ const DropdownSkeleton: React.FC<DropdownSkeletonProps> = ({
return (
<div className={wrapperClasses} {...rest}>
<div className={`${prefix}--list-box__field`}>
<span className={`${prefix}--list-box__label`} />
{!hideLabel && (
<span className={`${prefix}--list-box__label ${prefix}--skeleton`} />
)}
</div>
</div>
);
Expand All @@ -48,6 +64,11 @@ DropdownSkeleton.propTypes = {
*/
className: PropTypes.string,

/**
* Specify whether the label should be hidden, or not
*/
hideLabel: PropTypes.bool,

/**
* Specify the size of the ListBox.
*/
Expand Down

0 comments on commit 7427e94

Please sign in to comment.