diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..174cdb558f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +# Ignore everything +* +# Except js files +!*.js +# Look for js files in subdirectories +!*/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..0265439516 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false, + "printWidth": 120 +} diff --git a/packages/documentation-framework/layouts/sideNavLayout/sideNavLayout.js b/packages/documentation-framework/layouts/sideNavLayout/sideNavLayout.js index 2fb848d057..de89641546 100644 --- a/packages/documentation-framework/layouts/sideNavLayout/sideNavLayout.js +++ b/packages/documentation-framework/layouts/sideNavLayout/sideNavLayout.js @@ -9,7 +9,6 @@ import { DropdownGroup, DropdownList, Divider, - Icon, Masthead, MastheadToggle, MastheadMain, @@ -26,7 +25,7 @@ import { SearchInput, ToggleGroup, ToggleGroupItem, - MastheadLogo, + MastheadLogo } from '@patternfly/react-core'; import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon'; import GithubIcon from '@patternfly/react-icons/dist/esm/icons/github-icon'; @@ -48,40 +47,32 @@ const HeaderTools = ({ isRTL, setIsRTL, isDarkTheme, - setIsDarkTheme, + setIsDarkTheme }) => { const latestVersion = versions.Releases.find((version) => version.latest); - const previousReleases = Object.values(versions.Releases).filter( - (version) => !version.hidden && !version.latest - ); + const previousReleases = Object.values(versions.Releases).filter((version) => !version.hidden && !version.latest); const hasSearch = algolia; const [isDropdownOpen, setDropdownOpen] = useState(false); const [searchValue, setSearchValue] = React.useState(''); const [isSearchExpanded, setIsSearchExpanded] = React.useState(false); const getDropdownItem = (version, isLatest = false) => ( - - {`Current ${version.name}`} + + {`Release ${version.name}`} ); const onChange = (_evt, value) => { - setSearchValue(value); + setSearchValue(value); }; - const onToggleExpand = (_evt, isSearchExpanded) => { - setIsSearchExpanded(!isSearchExpanded); - }; + const onToggleExpand = (_evt, isSearchExpanded) => { + setIsSearchExpanded(!isSearchExpanded); + }; const toggleDarkTheme = (_evt, selected) => { const darkThemeToggleClicked = !selected === isDarkTheme; - document - .querySelector('html') - .classList.toggle('pf-v6-theme-dark', darkThemeToggleClicked); + document.querySelector('html').classList.toggle('pf-v6-theme-dark', darkThemeToggleClicked); setIsDarkTheme(darkThemeToggleClicked); }; @@ -90,7 +81,7 @@ const HeaderTools = ({ if (hasSearch && isSearchExpanded) { attachDocSearch(algolia, '.ws-global-search .pf-v6-c-text-input-group__text-input', 1000); } - }, [isSearchExpanded]) + }, [isSearchExpanded]); return ( @@ -137,7 +128,11 @@ const HeaderTools = ({ value={searchValue} onChange={onChange} onClear={(_evt) => onChange(_evt, '')} - expandableInput={{ isExpanded: isSearchExpanded, onToggleExpand, toggleAriaLabel: 'Expandable search input toggle' }} + expandableInput={{ + isExpanded: isSearchExpanded, + onToggleExpand, + toggleAriaLabel: 'Expandable search input toggle' + }} /> )} @@ -164,55 +159,29 @@ const HeaderTools = ({ onClick={() => setDropdownOpen(!isDropdownOpen)} isExpanded={isDropdownOpen} > - Current alphas + Release 6.0.0 )} + popperProps={{ position: 'right' }} > - - {getDropdownItem(latestVersion, true)} - + {getDropdownItem(latestVersion, true)} {previousReleases.length > 0 && ( - + - {previousReleases - .slice(0, 3) - .map((version) => getDropdownItem(version))} + {previousReleases.slice(0, 3).map((version) => getDropdownItem(version))} )} - - - - PatternFly 6 - - - - - + PatternFly 5 @@ -253,21 +222,17 @@ export function attachDocSearch(algolia, inputSelector, timeout) { inputSelector, autocompleteOptions: { hint: false, - appendTo: `.ws-global-search .pf-v6-c-text-input-group`, + appendTo: `.ws-global-search .pf-v6-c-text-input-group` }, debug: process.env.NODE_ENV !== 'production', - ...algolia, + ...algolia }); } else { setTimeout(() => attachDocSearch(algolia, inputSelector, timeout), timeout); } } -export const SideNavLayout = ({ - children, - groupedRoutes, - navOpen: navOpenProp, -}) => { +export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp }) => { const algolia = process.env.algolia; const hasGdprBanner = process.env.hasGdprBanner; const hasVersionSwitcher = process.env.hasVersionSwitcher; @@ -319,19 +284,9 @@ export const SideNavLayout = ({ PF-HorizontalLogo-Color - + - + @@ -400,9 +355,7 @@ export const SideNavLayout = ({ mainComponent="div" masthead={masthead} sidebar={SideBar} - skipToContent={ - Skip to content - } + skipToContent={Skip to content} isManagedSidebar defaultManagedSidebarIsOpen={navOpenProp} >