-
Notifications
You must be signed in to change notification settings - Fork 8
feat(templates): add side-nav-mini template (collapsible mini navigation) for React, Angular, WC #1716
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
Merged
Merged
feat(templates): add side-nav-mini template (collapsible mini navigation) for React, Angular, WC #1716
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
1db0a71
feat(igx-templates): add side-nav-mini project template with collapsi…
ivanvpetrov d3019de
fix(cli:templates): align angular side-nav template layout
georgianastasov 0cc556b
fix(cli:templates): align web components side-nav template layout
georgianastasov b5d44a4
fix(cli:templates): align react side-nav template layout
georgianastasov 074c4cf
fix(templates): add navigation role to resources container
georgianastasov fba1438
Potential fix for pull request finding
georgianastasov 0576410
Potential fix for pull request finding
georgianastasov 65604f2
Potential fix for pull request finding
georgianastasov fb5da8a
Potential fix for pull request finding
georgianastasov 278ac98
feat(templates): add side-nav-mini template (collapsible mini navigat…
ivanvpetrov 4943879
Merge branch 'master' into ipetrov/new-mini-side-nav-template
ivanvpetrov a03548c
fix(cli:templates): align side-nav resources layout responsiveness
georgianastasov 44e8a8a
Merge branch 'ganastasov/align-side-nav-templates' of https://github.…
georgianastasov 1ce3b97
Merge branch 'ganastasov/align-side-nav-templates' into ipetrov/new-m…
ivanvpetrov 03fa783
feat(templates): side-nav-mini template for React and WC now match th…
ivanvpetrov 84ec5aa
Potential fix for pull request finding
kdinev cc43e19
Potential fix for pull request finding
kdinev ca6feb7
feat(templates): fix side-nav-mini animation
ivanvpetrov 59c0b96
fix(cli:templates): update icons
georgianastasov 097829c
feat(templates): fix side-nav-mini icon size
ivanvpetrov 87430f4
Merge branch 'ganastasov/align-side-nav-templates' into ipetrov/new-m…
ivanvpetrov ad6ec27
feat(templates): fix some code according to base PR
ivanvpetrov ecc02bb
Potential fix for pull request finding
ivanvpetrov 16a0d35
Potential fix for pull request finding
ivanvpetrov c3909d0
Potential fix for pull request finding
ivanvpetrov fec5e04
Merge branch 'master' into ipetrov/new-mini-side-nav-template
kdinev fcb3ddd
fix(templates): css variables redundancy fixed
ivanvpetrov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/cli/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app-routes.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import Home from './home/home'; | ||
|
|
||
| export const routes = [ | ||
| { path: '/', element: <Home />, text: 'Home', icon: 'home' } | ||
| ]; |
91 changes: 91 additions & 0 deletions
91
packages/cli/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| .app { | ||
| display: flex; | ||
| flex-flow: column nowrap; | ||
| height: 100%; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| .app__navbar { | ||
| display: flex; | ||
| align-items: center; | ||
| flex: 0 0 auto; | ||
| height: 56px; | ||
| padding: 0 16px; | ||
| background: #239ef0; | ||
| box-shadow: 0 2px 4px rgba(0, 0, 0, .24); | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| .app__menu-button { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| width: 40px; | ||
| height: 40px; | ||
| padding: 0; | ||
| color: #000; | ||
| border: 0; | ||
| background: transparent; | ||
| cursor: pointer; | ||
| font-size: 24px; | ||
| } | ||
|
|
||
| .app__title { | ||
| margin: 0 0 0 16px; | ||
| color: #000; | ||
| font-size: 1.25rem; | ||
| font-weight: 600; | ||
| line-height: 1; | ||
| } | ||
|
|
||
| .app__body { | ||
| display: flex; | ||
| flex: 1 1 auto; | ||
| min-height: 0; | ||
| } | ||
|
|
||
| .app__drawer { | ||
| flex: 0 0 auto; | ||
| height: 100%; | ||
| --menu-full-width: 280px; | ||
| --ig-nav-drawer-item-active-background: #e0f2ff; | ||
| --ig-nav-drawer-item-active-text-color: #0075d2; | ||
| --ig-nav-drawer-item-active-icon-color: #0075d2; | ||
| } | ||
|
|
||
| .app--mini .app__drawer { | ||
| --menu-full-width: 68px; | ||
| } | ||
|
ivanvpetrov marked this conversation as resolved.
|
||
|
|
||
| igc-nav-drawer.app__drawer::part(base) { | ||
| transition: width 0.3s ease-out; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| .app--mini igc-nav-drawer-item::part(base) { | ||
| justify-content: center; | ||
| width: 40px; | ||
| min-height: 40px; | ||
| padding: 0; | ||
| margin: 4px auto; | ||
| border-radius: 8px; | ||
| } | ||
|
|
||
| .app--mini igc-nav-drawer-item::part(content) { | ||
| display: none; | ||
| } | ||
|
|
||
| .app__content { | ||
| flex: 1 1 auto; | ||
| min-width: 0; | ||
| overflow: auto; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: flex-start; | ||
| } | ||
|
|
||
| @media (max-width: 1024px) { | ||
| .app__menu-button { | ||
| display: none; | ||
| } | ||
| } | ||
20 changes: 20 additions & 0 deletions
20
packages/cli/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { beforeAll, expect, test } from 'vitest'; | ||
| import { render } from '@testing-library/react'; | ||
| import { MemoryRouter } from 'react-router-dom'; | ||
| import App from './app'; | ||
| import 'element-internals-polyfill'; | ||
| import { setupTestMocks } from '../setupTests'; | ||
|
|
||
| beforeAll(() => { | ||
| setupTestMocks(); | ||
| }); | ||
|
|
||
| test('renders without crashing', () => { | ||
| const wrapper = render( | ||
| <MemoryRouter> | ||
| <App /> | ||
| </MemoryRouter> | ||
| ); | ||
|
|
||
| expect(wrapper).toBeTruthy(); | ||
| }); |
78 changes: 78 additions & 0 deletions
78
packages/cli/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import { useState, useEffect } from 'react'; | ||
| import { Outlet, useNavigate, useLocation } from 'react-router-dom'; | ||
| import { | ||
| IgrNavDrawer, | ||
| IgrNavDrawerItem, | ||
| IgrIcon, | ||
| registerIcon, | ||
| } from 'igniteui-react'; | ||
| import { routes } from './app-routes'; | ||
| import 'igniteui-webcomponents/themes/light/bootstrap.css'; | ||
| import './app.css'; | ||
|
|
||
| const materialIcons = [ | ||
| ['home', 'action/svg/production/ic_home_24px.svg'], | ||
| ['menu', 'navigation/svg/production/ic_menu_24px.svg'], | ||
| ['apps', 'navigation/svg/production/ic_apps_24px.svg'], | ||
| ['code', 'action/svg/production/ic_code_24px.svg'], | ||
| ['build', 'action/svg/production/ic_build_24px.svg'], | ||
| ['palette', 'image/svg/production/ic_palette_24px.svg'], | ||
| ] as const; | ||
|
|
||
| materialIcons.forEach(([name, path]) => | ||
| registerIcon(name, `https://unpkg.com/material-design-icons@3.0.1/${path}`, 'material') | ||
| ); | ||
|
|
||
| const navRoutes = routes.filter((r: any) => r.text); | ||
|
ivanvpetrov marked this conversation as resolved.
Outdated
|
||
|
|
||
| export default function App() { | ||
| const [drawerOpen, setDrawerOpen] = useState(true); | ||
| const navigate = useNavigate(); | ||
| const location = useLocation(); | ||
|
|
||
| useEffect(() => { | ||
| const mq = window.matchMedia('(min-width: 1025px)'); | ||
| const update = () => setDrawerOpen(mq.matches); | ||
| update(); | ||
| mq.addEventListener('change', update); | ||
| return () => mq.removeEventListener('change', update); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <div className="app"> | ||
| <header className="app__navbar"> | ||
| <button | ||
| className="app__menu-button" | ||
| type="button" | ||
| aria-label="Toggle navigation" | ||
| onClick={() => setDrawerOpen(o => !o)} | ||
| > | ||
| <IgrIcon name="menu" collection="material" /> | ||
| </button> | ||
| <h1 className="app__title">$(name)</h1> | ||
| </header> | ||
| <div className={!drawerOpen ? 'app__body app--mini' : 'app__body'}> | ||
| <IgrNavDrawer className="app__drawer" open position="relative"> | ||
| {navRoutes.map((route: any) => ( | ||
|
ivanvpetrov marked this conversation as resolved.
Outdated
|
||
| <IgrNavDrawerItem | ||
| key={route.path} | ||
| active={location.pathname === route.path} | ||
| onClick={() => navigate(route.path)} | ||
| > | ||
| <IgrIcon | ||
| slot="icon" | ||
| name={route.icon || 'apps'} | ||
| collection="material" | ||
| style={location.pathname === route.path ? { color: '#0075D2' } : undefined} | ||
| /> | ||
| <span slot="content">{route.text}</span> | ||
| </IgrNavDrawerItem> | ||
| ))} | ||
| </IgrNavDrawer> | ||
| <div className="app__content"> | ||
| <Outlet /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
69 changes: 69 additions & 0 deletions
69
packages/cli/templates/react/igr-ts/projects/side-nav-mini/files/src/app/home/home.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import logo from "/logo.svg"; | ||
| import { IgrIcon } from "igniteui-react"; | ||
| import styles from "./style.module.css"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <main className={styles.home}> | ||
| <div className={styles.intro}> | ||
| <h1 className={styles.header}>Welcome to Ignite UI for React!</h1> | ||
| <p className={styles.description}> | ||
| A routed application shell with a responsive side navigation drawer and curated Ignite UI resources. | ||
| </p> | ||
| </div> | ||
|
|
||
| <img src={logo} className={styles.logo} alt="Ignite UI for React" /> | ||
|
|
||
| <div className={styles.resources} role="navigation" aria-label="Ignite UI resources"> | ||
| <a | ||
| className={styles.resource} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| href="https://www.infragistics.com/products/ignite-ui-react" | ||
| > | ||
| <IgrIcon className={styles.resourceIcon} name="apps" collection="material" /> | ||
| <span> | ||
| <strong>Component Demos</strong> | ||
| <small>Browse React components and examples</small> | ||
| </span> | ||
| </a> | ||
| <a | ||
| className={styles.resource} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| href="https://github.com/IgniteUI/igniteui-react" | ||
| > | ||
| <IgrIcon className={styles.resourceIcon} name="code" collection="material" /> | ||
| <span> | ||
| <strong>React Repository</strong> | ||
| <small>Explore Ignite UI for React on GitHub</small> | ||
| </span> | ||
| </a> | ||
| <a | ||
| className={styles.resource} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| href="https://github.com/IgniteUI/igniteui-cli" | ||
| > | ||
| <IgrIcon className={styles.resourceIcon} name="build" collection="material" /> | ||
| <span> | ||
| <strong>Ignite UI CLI</strong> | ||
| <small>Review the CLI source and project tooling</small> | ||
| </span> | ||
| </a> | ||
| <a | ||
| className={styles.resource} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| href="https://www.figma.com/@infragistics" | ||
| > | ||
| <IgrIcon className={styles.resourceIcon} name="palette" collection="material" /> | ||
| <span> | ||
| <strong>Figma UI Kit</strong> | ||
| <small>Open Infragistics design resources</small> | ||
| </span> | ||
| </a> | ||
| </div> | ||
| </main> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.