Skip to content
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

Inconsistent documentation around Navbar components #7187

Open
ggdouglas opened this issue Jan 17, 2025 · 0 comments
Open

Inconsistent documentation around Navbar components #7187

ggdouglas opened this issue Jan 17, 2025 · 0 comments

Comments

@ggdouglas
Copy link
Contributor

There are two ways of referencing/importing <Navbar> sub-components. Either they imported directly from a module or namespaced as an alias off of Navbar itself (similar to the "namespaced" or compound component pattern);

Imported directly:

import {
Alignment,
Button,
Classes,
H5,
Navbar,
NavbarDivider,
NavbarGroup,
NavbarHeading,
Switch,
} from "@blueprintjs/core";

<Navbar>
<NavbarGroup align={alignRight ? Alignment.RIGHT : Alignment.LEFT}>
<NavbarHeading>Blueprint</NavbarHeading>
<NavbarDivider />
<Button className={Classes.MINIMAL} icon="home" text="Home" />
<Button className={Classes.MINIMAL} icon="document" text="Files" />
</NavbarGroup>
</Navbar>

Namespaced:

The __Navbar__ API includes four stateless React components:
* __Navbar__
* __NavbarGroup__ (aliased as `Navbar.Group`)
* __NavbarHeading__ (aliased as `Navbar.Heading`)
* __NavbarDivider__ (aliased as `Navbar.Divider`)

<Navbar>
<Navbar.Group align={Alignment.LEFT}>
<Navbar.Heading>Blueprint</Navbar.Heading>
<Navbar.Divider />
<Button className="@ns-minimal" icon="home" text="Home" />
<Button className="@ns-minimal" icon="document" text="Files" />
</Navbar.Group>
</Navbar>

<Navbar className={Classes.DARK} fixedToTop={true}>
<Navbar.Group align={Alignment.LEFT}>
<Navbar.Heading>Blueprint Table</Navbar.Heading>
</Navbar.Group>
<Navbar.Group align={Alignment.RIGHT}>
<AnchorButton active={isIndex} href="index.html" minimal={true} text="Home" />
<Navbar.Divider />
<AnchorButton active={!isIndex} href="features.html" minimal={true} text="Features (Legacy)" />
<Navbar.Divider />
<Switch style={darkThemeToggleStyles} label="Dark theme" onChange={this.handleToggleDarkTheme} />
</Navbar.Group>
</Navbar>

It seems odd that Navbar is a special case where other components are not organized this way (e.g. Menu). Perhaps we should consider dropping this pattern to enforce better organization/consistency among Blueprint components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant