-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] rewrite Navigator Bar based on Bootstrap 5
[remove] useless Cell Router model
- Loading branch information
Showing
14 changed files
with
275 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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 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 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,24 @@ | ||
import { JsxProps } from 'dom-renderer'; | ||
import { FC } from 'web-cell'; | ||
|
||
import { Size } from './type'; | ||
|
||
export interface ContainerProps extends JsxProps<HTMLDivElement> { | ||
fluid?: boolean | Size; | ||
} | ||
|
||
export const Container: FC<ContainerProps> = ({ | ||
className = '', | ||
fluid, | ||
children, | ||
...props | ||
}) => ( | ||
<div | ||
className={`container${ | ||
fluid === true ? '-fluid' : fluid ? `-${fluid}` : '' | ||
} ${className}`} | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
); |
This file contains 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,22 @@ | ||
import { JsxProps } from 'dom-renderer'; | ||
import { FC } from 'web-cell'; | ||
|
||
export interface NavLinkProps extends JsxProps<HTMLAnchorElement> { | ||
active?: boolean; | ||
} | ||
|
||
export const NavLink: FC<NavLinkProps> = ({ | ||
className = '', | ||
active, | ||
children, | ||
...props | ||
}) => ( | ||
<li className="nav-item"> | ||
<a | ||
className={`nav-link ${active ? 'active' : ''} ${className}`} | ||
{...props} | ||
> | ||
{children} | ||
</a> | ||
</li> | ||
); |
This file contains 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,57 @@ | ||
import { JsxProps } from 'dom-renderer'; | ||
import { FC } from 'web-cell'; | ||
|
||
import { BackgroundColor, PositionY, Size } from './type'; | ||
|
||
export type NavbarBrandProps = JsxProps<HTMLAnchorElement>; | ||
|
||
export const NavbarBrand: FC<NavbarBrandProps> = ({ | ||
className = '', | ||
children, | ||
...props | ||
}) => ( | ||
<a className={`navbar-brand ${className}`} {...props}> | ||
{children} | ||
</a> | ||
); | ||
|
||
export type NavbarToggleProps = JsxProps<HTMLButtonElement>; | ||
|
||
export const NavbarToggle: FC<NavbarToggleProps> = ({ | ||
className = '', | ||
type, | ||
children, | ||
...props | ||
}) => ( | ||
<button className={`navbar-toggler ${className}`} type="button" {...props}> | ||
<span className="navbar-toggler-icon" /> | ||
</button> | ||
); | ||
|
||
export interface NavbarProps extends JsxProps<HTMLDivElement> { | ||
variant?: 'light' | 'dark'; | ||
bg?: BackgroundColor; | ||
expand?: boolean | Size; | ||
fixed?: PositionY; | ||
sticky?: PositionY; | ||
} | ||
|
||
export const Navbar: FC<NavbarProps> = ({ | ||
variant = 'light', | ||
bg = 'body-tertiary', | ||
fixed, | ||
sticky, | ||
expand, | ||
children | ||
}) => ( | ||
<nav | ||
className={`navbar bg-${bg} ${fixed ? `fixed-${fixed}` : ''} ${ | ||
sticky ? `sticky-${sticky}` : '' | ||
} ${ | ||
expand ? `navbar-expand${expand === true ? '' : `-${expand}`}` : '' | ||
}`} | ||
data-bs-theme={variant} | ||
> | ||
{children} | ||
</nav> | ||
); |
This file contains 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,87 @@ | ||
import { JsxProps } from 'dom-renderer'; | ||
import { FC } from 'web-cell'; | ||
import { uniqueID } from 'web-utility'; | ||
|
||
export const OffcanvasTitle: FC<JsxProps<HTMLHeadingElement>> = ({ | ||
className = '', | ||
children, | ||
...props | ||
}) => ( | ||
<h5 className={`offcanvas-title ${className}`} {...props}> | ||
{children} | ||
</h5> | ||
); | ||
|
||
export interface OffcanvasHeaderProps extends JsxProps<HTMLDivElement> { | ||
closeButton?: boolean; | ||
} | ||
|
||
export const OffcanvasHeader: FC<OffcanvasHeaderProps> = ({ | ||
className = '', | ||
closeButton, | ||
children, | ||
...props | ||
}) => ( | ||
<div className={`offcanvas-header ${className}`} {...props}> | ||
{children} | ||
|
||
{closeButton && ( | ||
<button | ||
className="btn-close" | ||
type="button" | ||
data-bs-dismiss="offcanvas" | ||
ariaLabel="Close" | ||
/> | ||
)} | ||
</div> | ||
); | ||
|
||
export const OffcanvasBody: FC<JsxProps<HTMLDivElement>> = ({ | ||
className = '', | ||
children, | ||
...props | ||
}) => ( | ||
<div className={`offcanvas-body ${className}`} {...props}> | ||
{children} | ||
</div> | ||
); | ||
|
||
export interface OffcanvasProps extends JsxProps<HTMLDivElement> { | ||
show?: boolean; | ||
} | ||
|
||
export const Offcanvas: FC<OffcanvasProps> = ({ | ||
className = '', | ||
show, | ||
children, | ||
...props | ||
}) => ( | ||
<div | ||
className={`offcanvas ${className} ${show ? 'show' : ''}`} | ||
tabIndex={-1} | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
export interface OffcanvasBoxProps | ||
extends OffcanvasProps, | ||
OffcanvasHeaderProps { | ||
titleId?: string; | ||
} | ||
|
||
export const OffcanvasBox: FC<OffcanvasBoxProps> = ({ | ||
title, | ||
titleId = uniqueID(), | ||
closeButton, | ||
children, | ||
...props | ||
}) => ( | ||
<Offcanvas {...props} aria-labelledby={titleId}> | ||
<OffcanvasHeader closeButton={closeButton}> | ||
<OffcanvasTitle id={titleId}>{title}</OffcanvasTitle> | ||
</OffcanvasHeader> | ||
<OffcanvasBody>{children}</OffcanvasBody> | ||
</Offcanvas> | ||
); |
This file contains 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 @@ | ||
export * from './type'; | ||
export * from './Grid'; | ||
export * from './Nav'; | ||
export * from './Navbar'; | ||
export * from './Offcanvas'; |
This file contains 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,22 @@ | ||
type Subtle<T extends string> = `${T}${'' | '-subtle'}`; | ||
|
||
export type Color = | ||
| 'primary' | ||
| 'secondary' | ||
| 'success' | ||
| 'danger' | ||
| 'warning' | ||
| 'info' | ||
| 'light' | ||
| 'dark'; | ||
|
||
export type BackgroundColor = | ||
| Subtle<Color> | ||
| `body${'' | '-secondary' | '-tertiary'}` | ||
| 'black' | ||
| 'white' | ||
| 'transparent'; | ||
|
||
export type Size = 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; | ||
|
||
export type PositionY = 'top' | 'bottom'; |
This file contains 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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/> | ||
<link rel="icon" href="image/WebCell-0.png" /> | ||
<title>WebCell scaffold</title> | ||
<meta name="description" content="App Project scaffold of WebCell v2" /> | ||
<meta name="description" content="App Project scaffold of WebCell v3" /> | ||
<meta name="author" content="[email protected]" /> | ||
|
||
<link rel="manifest" href="index.webmanifest" /> | ||
|
This file contains 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 was deleted.
Oops, something went wrong.
Oops, something went wrong.
7520d95
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for web-cell-scaffold ready!
✅ Preview
https://web-cell-scaffold-6kd427a7r-techquery.vercel.app
Built with commit 7520d95.
This pull request is being automatically deployed with vercel-action