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

feat(treenav): labels for navigation #842

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 6.3.7 (2022-09-26)

- [842](https://github.com/influxdata/clockface/pull/842): Labels for Navigation Icons

### 6.3.6 (2022-09-22)

- [841](https://github.com/influxdata/clockface/pull/841): Inject @charset: UTF-8 into built CSS
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@influxdata/clockface",
"version": "6.3.6",
"version": "6.3.7",
"license": "MIT",
"main": "dist/index.js",
"style": "dist/index.css",
Expand Down
4 changes: 3 additions & 1 deletion src/Components/TreeNav/TreeNav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}
}

$cf-tree-nav__header-height: 60px;
$cf-tree-nav__header-height: 70px;

.cf-tree-nav--menu {
position: absolute;
Expand Down Expand Up @@ -263,6 +263,7 @@ a.cf-tree-nav--item-block:active {
&:focus {
color: $cf-tree-nav__text-hover;
}
margin-left: 5px;
}

.cf-tree-nav--square {
Expand All @@ -271,6 +272,7 @@ a.cf-tree-nav--item-block:active {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;

.cf-icon {
font-size: 1.5em;
Expand Down
19 changes: 18 additions & 1 deletion src/Components/TreeNav/TreeNavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface TreeNavItemProps extends Omit<StandardFunctionProps, 'id'> {
active?: boolean
/** Optional link element. Will override onClick prop */
linkElement?: RenderLinkElement
isTreeNavCollapsed?: boolean
}

export type TreeNavItemRef = HTMLButtonElement
Expand All @@ -37,6 +38,8 @@ export const TreeNavItem = forwardRef<TreeNavItemRef, TreeNavItemProps>(
children = null,
className,
linkElement,
shortLabel,
isTreeNavCollapsed = true,
},
ref
) => {
Expand All @@ -54,7 +57,21 @@ export const TreeNavItem = forwardRef<TreeNavItemRef, TreeNavItemProps>(
if (linkElement) {
const linkItems = (
<>
<div className="cf-tree-nav--square">{icon}</div>
<div className="cf-tree-nav--square">
{icon}
{isTreeNavCollapsed && (
<span
style={{
fontSize: '9px',
display: 'flex',
justifyContent: 'center',
}}
className={'cf-tree-nav--short-label'}
>
{shortLabel}
</span>
)}
</div>
<div className="cf-tree-nav--label">{label}</div>
</>
)
Expand Down
2 changes: 1 addition & 1 deletion src/Styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ $cf-overlay--mask-z: 10;
-----------------------------------------------------------------------------
*/

$cf-tree-nav__width: 60px;
$cf-tree-nav__width: 70px;
$cf-tree-nav__expanded-width: 260px;
$cf-tree-nav__small-height: 44px;

Expand Down