Skip to content

Commit

Permalink
chore: merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonjoseph committed Dec 4, 2024
2 parents 27e8282 + c8273a1 commit 8ae08af
Show file tree
Hide file tree
Showing 14 changed files with 504 additions and 376 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## [4.1.18](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.17...v4.1.18) (2024-12-04)

## [4.1.17](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.16...v4.1.17) (2024-12-04)

## [4.1.16](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.15...v4.1.16) (2024-12-03)

## [4.1.15](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.14...v4.1.15) (2024-11-26)


### Bug Fixes

* **search:** keyboard support for enter key ([#1545](https://github.com/carbon-design-system/gatsby-theme-carbon/issues/1545)) ([eaf0a12](https://github.com/carbon-design-system/gatsby-theme-carbon/commit/eaf0a1244428877916517d7121fd6ade8c1fda43))

## [4.1.14](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.13...v4.1.14) (2024-11-21)

## [4.1.13](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.12...v4.1.13) (2024-11-06)

## [4.1.12](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.11...v4.1.12) (2024-11-06)

## [4.1.11](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.10...v4.1.11) (2024-11-01)


### Bug Fixes

* **leftnavtree:** style updates ([#1520](https://github.com/carbon-design-system/gatsby-theme-carbon/issues/1520)) ([2f258ed](https://github.com/carbon-design-system/gatsby-theme-carbon/commit/2f258ed9573b01f5f6521b28e0a306e7e51ec7c8))

## [4.1.10](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.9...v4.1.10) (2024-11-01)

## [4.1.9](https://github.com/carbon-design-system/gatsby-theme-carbon/compare/v4.1.8...v4.1.9) (2024-10-24)
Expand Down
33 changes: 33 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Security Policy

## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| 4.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

_Please do not report security vulnerabilities through public GitHub issues._

Instead, report a vulnerability through GitHub's security advisory feature at
https://github.com/carbon-design-system/carbon/security/advisories/new

Please include a description of the issue, the steps you took to create the
issue, affected versions, and, if known, mitigations for the issue. Our team
aims to respond to all new vulnerability reports within 7 business days.

Additional information on reporting vulnerabilities to IBM is available at
https://www.ibm.com/trust/security-psirt

## Preferred languages

We prefer all communications to be in English.

## Comments on this policy

If you have suggestions on how this process could be improved please
[submit a pull request](https://github.com/carbon-design-system/gatsby-theme-carbon/compare)
or [file an issue](https://github.com/carbon-design-system/gatsby-theme-carbon/issues/new) to
discuss.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-theme-carbon-workspace",
"private": true,
"version": "4.1.10",
"version": "4.1.18",
"packageManager": "[email protected]",
"repository": {
"url": "[email protected]:carbon-design-system/gatsby-theme-carbon.git",
Expand Down
4 changes: 2 additions & 2 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "example",
"private": true,
"version": "4.1.10",
"version": "4.1.18",
"license": "Apache 2.0",
"scripts": {
"dev": "gatsby develop -H 0.0.0.0",
Expand All @@ -14,7 +14,7 @@
"dependencies": {
"@carbon/icons-react": "^11.43.0",
"gatsby": "^5.13.6",
"gatsby-theme-carbon": "^4.1.10",
"gatsby-theme-carbon": "^4.1.18",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
Expand Down
32 changes: 32 additions & 0 deletions packages/gatsby-theme-carbon/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<h1 align="center">
Gatsby Theme Carbon
</h1>

> :exclamation: This project is maintained by community contributions. The original
> contributor, Carbon Design System, is no longer involved in maintaining this project.
[![release-it](https://github.com/carbon-design-system/gatsby-theme-carbon/actions/workflows/release.yml/badge.svg)](https://github.com/carbon-design-system/gatsby-theme-carbon/actions/workflows/release.yml)

<!-- NPM info -->

![npm (scoped)](https://img.shields.io/npm/v/gatsby-theme-carbon)
![npm](https://img.shields.io/npm/dt/gatsby-theme-carbon)
![npm](https://img.shields.io/npm/dw/gatsby-theme-carbon)

<!-- GitHub -->

![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/carbon-design-system/gatsby-theme-carbon)
![GitHub Repo stars](https://img.shields.io/github/stars/carbon-design-system/gatsby-theme-carbon)
![GitHub watchers](https://img.shields.io/github/watchers/carbon-design-system/gatsby-theme-carbon)
![GitHub issues](https://img.shields.io/github/issues/carbon-design-system/gatsby-theme-carbon)

The Gatsby Carbon theme includes all the configuration you need to build a beautiful site inspired by the [Carbon Design System](https://www.carbondesignsystem.com).

## Resources

- [Contribution guidelines](.github/CONTRIBUTING.md)
- [Getting Started](https://gatsby.carbondesignsystem.com/getting-started)
- [Guides](https://gatsby.carbondesignsystem.com/guides/configuration)
- [Components](https://gatsby.carbondesignsystem.com/components/markdown)
- [Demo](https://gatsby.carbondesignsystem.com/demo)
- [Gallery](https://gatsby.carbondesignsystem.com/gallery)
8 changes: 4 additions & 4 deletions packages/gatsby-theme-carbon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-theme-carbon",
"version": "4.1.10",
"version": "4.1.18",
"main": "index.js",
"author": "vpicone <[email protected]> (@vpicone)",
"repository": {
Expand All @@ -25,10 +25,10 @@
"@babel/core": "^7.24.7",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-syntax-jsx": "^7.24.7",
"@carbon/elements": "^11.56.0",
"@carbon/elements": "^11.57.0",
"@carbon/grid": "^11.29.0",
"@carbon/pictograms-react": "^11.68.0",
"@carbon/react": "^1.69.0",
"@carbon/pictograms-react": "^11.69.0",
"@carbon/react": "^1.71.0",
"@carbon/themes": "^11.43.0",
"@garcia-enterprise/gatsby-plugin-sass-resources": "^4.0.2",
"@mdx-js/mdx": "^3.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { graphql, navigate, useStaticQuery } from 'gatsby';
import cx from 'classnames';
import NavContext from '../../util/context/NavContext';
import { useOnClickOutside } from '../../util/hooks';
import { convertFilePathToUrl } from '../../util/convertFilePathToUrl';

import {
container,
Expand Down Expand Up @@ -118,7 +119,7 @@ const GlobalSearchInput = () => {
case 'Enter': {
e.preventDefault();
if (results[focusedItem]) {
navigate(results[focusedItem].path);
navigate(convertFilePathToUrl(results[focusedItem].path));
}
break;
}
Expand Down
18 changes: 2 additions & 16 deletions packages/gatsby-theme-carbon/src/components/GlobalSearch/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
tab,
} from './GlobalSearch.module.scss';

import { convertFilePathToUrl } from '../../util/convertFilePathToUrl';

export const MenuContext = createContext();

const Menu = ({ results, onKeyDown }) => {
Expand Down Expand Up @@ -77,22 +79,6 @@ const MenuItem = ({ page, index, onKeyDown, id }) => {
[active]: focusedItem === index,
});

function convertFilePathToUrl(filePath) {
const pagesIndex = filePath.lastIndexOf('/pages/');
if (filePath.lastIndexOf('/pages/') === -1) return null;

const fileName = filePath.slice(
pagesIndex + '/pages/'.length,
-'.mdx'.length
);
const normalizedFileName = fileName.endsWith('/index')
? fileName.slice(0, -'/index'.length)
: fileName;
const urlPath = `/${normalizedFileName.split('/').join('/')}/`;

return urlPath;
}

const url = convertFilePathToUrl(page.path);

return (
Expand Down
61 changes: 32 additions & 29 deletions packages/gatsby-theme-carbon/src/components/LeftNav/LeftNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, {
useCallback,
useState,
} from 'react';
import { SideNav, SideNavItems } from '@carbon/react';
import { SideNav, SideNavItems, Theme } from '@carbon/react';
import { useNavItems } from '../../util/NavItems';

import NavContext from '../../util/context/NavContext';
Expand All @@ -32,6 +32,7 @@ const LeftNav = (props) => {
const sideNavListRef = useRef();

const navItems = useNavItems();
const themeValue = props.theme === 'dark' ? 'g100' : props.theme;

const hasNestedLevels = useCallback(() => {
let nestedLevels = false;
Expand Down Expand Up @@ -97,34 +98,36 @@ const LeftNav = (props) => {
expanded={leftNavIsOpen}
onClick={closeSwitcher}
onKeyPress={closeSwitcher}>
{isTreeView ? (
<LeftNavTree
items={navItems}
theme={props.theme}
pathPrefix={pathPrefix}
/>
) : (
<SideNav
ref={sideNavRef}
aria-label="Side navigation"
expanded={navigationStyle ? leftNavIsOpen : true}
defaultExpanded={!navigationStyle}
isPersistent={!navigationStyle}
className={getLeftNavClassNames()}>
<SideNavItems className="sidenav-list">
{typeof isTreeView !== 'undefined' &&
navItems.map((item, i) => (
<LeftNavItem
items={item.pages}
category={item.title}
key={i}
hasDivider={item.hasDivider}
/>
))}
<LeftNavResourceLinks />
</SideNavItems>
</SideNav>
)}
<Theme theme={themeValue}>
{isTreeView ? (
<LeftNavTree
items={navItems}
pathPrefix={pathPrefix}
theme={themeValue}
/>
) : (
<SideNav
ref={sideNavRef}
aria-label="Side navigation"
expanded={navigationStyle ? leftNavIsOpen : true}
defaultExpanded={!navigationStyle}
isPersistent={!navigationStyle}
className={getLeftNavClassNames()}>
<SideNavItems className="sidenav-list">
{typeof isTreeView !== 'undefined' &&
navItems.map((item, i) => (
<LeftNavItem
items={item.pages}
category={item.title}
key={i}
hasDivider={item.hasDivider}
/>
))}
<LeftNavResourceLinks />
</SideNavItems>
</SideNav>
)}
</Theme>
</LeftNavWrapper>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '@carbon/react/scss/theme' as theme;

// White theme

nav.side-nav--white {
Expand All @@ -8,7 +10,6 @@ nav.side-nav--white {
// Dark theme

nav.side-nav--dark {
--cds-ui-03: #{$gray-80};
padding-top: $spacing-05;
background-color: $gray-100;
border-right: 1px solid $gray-80;
Expand Down Expand Up @@ -100,14 +101,14 @@ nav.side-nav--dark a.current-item {

.divider {
margin: $spacing-03 $spacing-05;
border-color: var(--cds-ui-03, #e0e0e0);
border-color: theme.$border-subtle-00;
border-style: solid;
border-bottom: none;
}

.divider-space {
margin-top: $spacing-05;
margin-bottom: $spacing-05;
margin-top: $spacing-03;
margin-bottom: $spacing-03;
}

// Moves icons to the right
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { memo, useCallback, useEffect, useState } from 'react';
import { useLocation } from '@reach/router';
import { Theme, TreeNode, TreeView } from '@carbon/react';
import { TreeNode, TreeView } from '@carbon/react';
import { Link, navigate } from 'gatsby';

import cx from 'classnames';
Expand All @@ -11,13 +11,16 @@ import { dfs } from '../../util/NavTree';

import LeftNavResourceLinks from './ResourceLinks';

const LeftNavTree = ({ items, theme, pathPrefix }) => {
const LeftNavTree = ({ items, pathPrefix, theme }) => {
const [itemNodes, setItemNodes] = useState([]);
const [treeActiveItem, setTreeActiveItem] = useState({});
const [activePath, setActivePath] = useState('');
const location = useLocation();

const themeValue = theme === 'dark' ? 'g100' : theme;
const containerClassNames = cx(styles.container, {
[styles.container_g10]: theme === 'g10',
[styles.container_g90]: theme === 'g90',
});

useEffect(() => {
const newItemNodeArray = [];
Expand Down Expand Up @@ -162,12 +165,12 @@ const LeftNavTree = ({ items, theme, pathPrefix }) => {
}

return (
<Theme className={styles.container} theme={themeValue}>
<nav className={containerClassNames}>
<TreeView label="Side navigation" hideLabel>
{renderTree({ nodes: itemNodes })}
<LeftNavResourceLinks />
</TreeView>
</Theme>
</nav>
);
};

Expand Down
Loading

0 comments on commit 8ae08af

Please sign in to comment.