Skip to content

Commit

Permalink
Merge pull request instructlab#413 from instructlab/pfCleanupGeneral
Browse files Browse the repository at this point in the history
PF cleanup: general notes, issue instructlab#369
  • Loading branch information
vishnoianil authored Dec 12, 2024
2 parents c4be474 + fe2a25b commit b876e10
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 14 deletions.
7 changes: 6 additions & 1 deletion src/components/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { PageSidebar } from '@patternfly/react-core/dist/dynamic/components/Page
import { PageSidebarBody } from '@patternfly/react-core/dist/dynamic/components/Page';
import { SkipToContent } from '@patternfly/react-core/dist/dynamic/components/SkipToContent';
import { Spinner } from '@patternfly/react-core/dist/dynamic/components/Spinner';
import { Bullseye } from '@patternfly/react-core';
import UserMenu from './UserMenu/UserMenu';
import { useSession } from 'next-auth/react';
// import { useTheme } from '../context/ThemeContext';
Expand Down Expand Up @@ -63,7 +64,11 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ children }) => {
}, [session, status, pathname, router]);

if (status === 'loading') {
return <Spinner />;
return (
<Bullseye>
<Spinner />
</Bullseye>
);
}

if (!session) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { DropdownItem } from '@patternfly/react-core/dist/esm/components/Dropdown/DropdownItem';
import { Icon } from '@patternfly/react-core';
import FileIcon from '@patternfly/react-icons/dist/esm/icons/file-icon';
import { KnowledgeFormData } from '@/types';

Expand Down Expand Up @@ -29,8 +30,18 @@ const DownloadAttribution: React.FC<Props> = ({ knowledgeFormData }) => {
};

return (
<DropdownItem key="DownloadAttribution" to="#default-link6" onClick={handleDownloadAttribution}>
<FileIcon /> Attribution File
<DropdownItem
key="DownloadAttribution"
to="#default-link6"
onClick={handleDownloadAttribution}
icon={
<Icon>
<FileIcon />
</Icon>
}
>
{' '}
Attribution File
</DropdownItem>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Dropdown } from '@patternfly/react-core/dist/dynamic/components/Dropdown';
import { DropdownList } from '@patternfly/react-core/dist/dynamic/components/Dropdown';
import { Icon } from '@patternfly/react-core';
import { MenuToggle, MenuToggleElement } from '@patternfly/react-core/dist/dynamic/components/MenuToggle';
import DownloadYaml from '../DownloadYaml/DownloadYaml';
import DownloadAttribution from '../DownloadAttribution/DownloadAttribution';
Expand Down Expand Up @@ -30,8 +31,18 @@ export const DownloadDropdown: React.FunctionComponent<Props> = ({ knowledgeForm
onSelect={onSelect}
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle ref={toggleRef} onClick={onToggleClick} isExpanded={isOpen}>
<DownloadIcon /> Download
<MenuToggle
ref={toggleRef}
onClick={onToggleClick}
isExpanded={isOpen}
icon={
<Icon>
<DownloadIcon />{' '}
</Icon>
}
>
{' '}
Download
</MenuToggle>
)}
ouiaId="DownloadDropdown"
Expand Down
15 changes: 13 additions & 2 deletions src/components/Contribute/Knowledge/DownloadYaml/DownloadYaml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { KnowledgeFormData, KnowledgeYamlData } from '@/types';
import { KnowledgeSchemaVersion } from '@/types/const';
import { dumpYaml } from '@/utils/yamlConfig';
import { Icon } from '@patternfly/react-core';
import { DropdownItem } from '@patternfly/react-core/dist/esm/components/Dropdown/DropdownItem';
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';

Expand Down Expand Up @@ -42,8 +43,18 @@ const DownloadYaml: React.FC<Props> = ({ knowledgeFormData, githubUsername }) =>
document.body.removeChild(a);
};
return (
<DropdownItem key="Download Yaml" to="#default-link6" onClick={handleDownloadYaml}>
<CodeIcon /> Yaml File
<DropdownItem
key="Download Yaml"
to="#default-link6"
onClick={handleDownloadYaml}
icon={
<Icon>
<CodeIcon />
</Icon>
}
>
{' '}
YAML File
</DropdownItem>
);
};
Expand Down
40 changes: 34 additions & 6 deletions src/components/Contribute/Knowledge/ViewDropdown/ViewDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
import { AttributionData, KnowledgeFormData, KnowledgeYamlData } from '@/types';
import { KnowledgeSchemaVersion } from '@/types/const';
import { dumpYaml } from '@/utils/yamlConfig';
import { Icon } from '@patternfly/react-core';
import FileIcon from '@patternfly/react-icons/dist/dynamic/icons/file-icon';
import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';

Expand Down Expand Up @@ -75,20 +76,47 @@ export const ViewDropdown: React.FunctionComponent<Props> = ({ knowledgeFormData
onSelect={onSelect}
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle ref={toggleRef} onClick={onToggleClick} isExpanded={isOpen}>
<EyeIcon />
<MenuToggle
ref={toggleRef}
onClick={onToggleClick}
isExpanded={isOpen}
icon={
<Icon>
<EyeIcon />{' '}
</Icon>
}
>
{' '}
View
</MenuToggle>
)}
ouiaId="DownloadDropdown"
shouldFocusToggleOnSelect
>
<DropdownList>
<DropdownItem key="view-yaml" onClick={handleViewYaml}>
<CodeIcon /> YAML Content
<DropdownItem
key="view-yaml"
onClick={handleViewYaml}
icon={
<Icon>
<CodeIcon />
</Icon>
}
>
{' '}
YAML Content
</DropdownItem>
<DropdownItem key="view-attribution" onClick={handleViewAttribution}>
<FileIcon /> Attribution Content
<DropdownItem
key="view-attribution"
onClick={handleViewAttribution}
icon={
<Icon>
<FileIcon />
</Icon>
}
>
{' '}
Attribution Content
</DropdownItem>
</DropdownList>
</Dropdown>
Expand Down
4 changes: 3 additions & 1 deletion src/components/Dashboard/Github/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ const DashboardGithub: React.FunctionComponent = () => {
</div>
}
>
<OutlinedQuestionCircleIcon />
<Button variant="plain" aria-label="more information">
<OutlinedQuestionCircleIcon />
</Button>
</Popover>
</Content>
</PageSection>
Expand Down

0 comments on commit b876e10

Please sign in to comment.