Skip to content

Commit

Permalink
feat(SideNav): add SideNav component into UIShell package (#389)
Browse files Browse the repository at this point in the history
* feat(ui-shell): add ui-shell components

* chore: fix build

* chore: add license

* chore: remove test temporarily

* chore: rename

* chore: rename

* chore: change name

* chore: update to UIShell

* chore: name

* chore: name

---------

Co-authored-by: Alison Joseph <[email protected]>
  • Loading branch information
emyarod and alisonjoseph authored Jan 30, 2025
1 parent 7652abf commit 072a73f
Show file tree
Hide file tree
Showing 18 changed files with 843 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/react/UIShell/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
@license
Copyright IBM Corp. 2025
This source code is licensed under the Apache-2.0 license found in the
LICENSE file in the root directory of this source tree.
-->

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@carbon-labs/react-ui-shell stackblitz</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions examples/react/UIShell/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "carbon-labs-react-ui-shell-example",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@carbon/react": "^1.72.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@carbon-labs/react-ui-shell": "latest",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.1",
"sass": "~1.83.0",
"typescript": "^5.2.2",
"vite": "^5.0.8"
}
}
17 changes: 17 additions & 0 deletions examples/react/UIShell/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import { SideNav } from '@carbon-labs/react-ui-shell/es/index';

function App() {
return <SideNav />;
}

export default App;
9 changes: 9 additions & 0 deletions examples/react/UIShell/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

@use '@carbon/react';
@use '@carbon-labs/react-ui-shell/scss/ui-shell';
19 changes: 19 additions & 0 deletions examples/react/UIShell/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';
import './index.scss';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
10 changes: 10 additions & 0 deletions examples/react/UIShell/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

/// <reference types="vite/client" />
25 changes: 25 additions & 0 deletions examples/react/UIShell/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions examples/react/UIShell/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
16 changes: 16 additions & 0 deletions examples/react/UIShell/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
64 changes: 64 additions & 0 deletions packages/react/src/components/UIShell/__stories__/UIShell.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as UIShellStories from './UIShell.stories';

<Meta isTemplate />

# UIShell

- **Initiative owner(s):** FILL THIS LINE
- **Status:** Draft
- **Target library:** TBD
- **Target library maintainer(s) / PR Reviewer(s):** N/A
- **Support channel:** `#carbon-labs`

{/* <!-- START doctoc generated TOC please keep comment here to allow auto update --> */}
{/* <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> */}

> 💡 Check our
> [Stackblitz](https://stackblitz.com/github/carbon-design-system/carbon-labs/tree/main/examples/react/UIShell)
> example implementation.
[![Edit carbon-labs](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/carbon-design-system/carbon-labs/tree/main/examples/react/UIShell)

## Table of Contents

- [Overview](#overview)
- [Getting started](#getting-started)

{/* <!-- END doctoc generated TOC please keep comment here to allow auto update --> */}

## Overview

Add description of component here

<Canvas of={UIShellStories.FixedSideNav} />

## Getting started

Here's a quick example to get you started.

```bash
yarn add @carbon/react
yarn add @carbon-labs/react-ui-shell
```

### JS (via import)

```javascript
import { SideNav } from '@carbon-labs/react-ui-shell/es/index';

function App() {
return <SideNav />;
}

export default App;
```

### SCSS

In your styles file import

```
@use '@carbon/react';
@use '@carbon-labs/react-ui-shell/scss/ui-shell';
```
Loading

0 comments on commit 072a73f

Please sign in to comment.