Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FileDetailsLabel): Kayla wants to change the background #150

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions packages/module/src/FileDetailsLabel/FileDetailsLabel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var(--pf-t--global--spacer--md);
gap: var(--pf-t--global--spacer--sm);
--pf-v6-c-label--m-clickable--hover--BackgroundColor: var(--pf-t--global--background--color--primary--hover);
border: var(--pf-t--global--border--width--strong) solid transparent;
}

.pf-v6-c-label.pf-chatbot__file-label {
Expand All @@ -19,7 +18,6 @@
.pf-v6-theme-dark {
.pf-v6-c-label.pf-chatbot__file-label {
--pf-v6-c-label--m-clickable--hover--Color: var(--pf-t--global--text--color--regular);
--pf-v6-c-label--m-clickable--hover--BackgroundColor: var(--pf-t--global--background--color--secondary--hover);
}

.pf-chatbot__file-label > .pf-v6-c-label__actions > .pf-v6-c-button.pf-m-plain > .pf-v6-c-button__icon {
Expand All @@ -29,9 +27,8 @@

.pf-chatbot__file-label.pf-m-clickable:hover,
.pf-chatbot__file-label.pf-m-clickable:focus-within {
border: var(--pf-t--global--border--width--strong) solid var(--pf-t--global--border--color--on-secondary);
--pf-v6-c-label--BackgroundColor: var(--pf-t--global--background--color--primary--hover);
--pf-v6-c-label--m-clickable--hover--BackgroundColor: var(--pf-t--global--background--color--primary--hover);
--pf-v6-c-label--BackgroundColor: var(--pf-t--global--background--color--action--plain--hover);
--pf-v6-c-label--m-clickable--hover--BackgroundColor: var(--pf-t--global--background--color--action--plain--hover);

.pf-chatbot__code-icon {
color: var(--pf-t--global--icon--color--status--custom--hover);
Expand Down
24 changes: 21 additions & 3 deletions packages/module/src/FileDetailsLabel/FileDetailsLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { PropsWithChildren } from 'react';
import { Flex, FlexItem, Label } from '@patternfly/react-core';
import { Button, Flex, FlexItem, Label } from '@patternfly/react-core';
import FileDetails from '../FileDetails';
import { Spinner } from '@patternfly/react-core';
import { TimesIcon } from '@patternfly/react-icons';

interface FileDetailsLabelProps {
/** Name of file, including extension */
Expand All @@ -12,15 +13,32 @@ interface FileDetailsLabelProps {
onClick?: (event: React.MouseEvent) => void;
/** Callback function for when close button is clicked */
onClose?: (event: React.MouseEvent) => void;
/** Aria label for close button */
closeButtonAriaLabel?: string;
}

export const FileDetailsLabel = ({
fileName,
isLoading,
onClick = undefined,
onClose = undefined
onClose = undefined,
closeButtonAriaLabel
}: PropsWithChildren<FileDetailsLabelProps>) => (
<Label className="pf-chatbot__file-label" onClose={onClose} onClick={onClick} textMaxWidth="370px">
<Label
className="pf-chatbot__file-label"
onClose={onClose}
closeBtn={
<Button
type="button"
variant="plain"
onClick={onClose}
aria-label={closeButtonAriaLabel ?? `Close ${fileName}`}
icon={<TimesIcon />}
/>
}
onClick={onClick}
textMaxWidth="370px"
>
<Flex
justifyContent={{ default: 'justifyContentCenter' }}
alignItems={{ default: 'alignItemsCenter' }}
Expand Down
Loading