-
Notifications
You must be signed in to change notification settings - Fork 17
feat(Header): use InternalLink for breadcrumb items #913
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
Conversation
…15-use-link-for-breadcrumbs
src/containers/Header/Header.scss
Outdated
| } | ||
| } | ||
|
|
||
| .g-breadcrumbs { |
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.
Let's try not to override library styles, but add custom classNames to components and define all stuff there.
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.
Done
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.
@Raubzeug btw, the solution is tricky enough
https://stackoverflow.com/questions/69883170/is-there-an-eslint-rule-to-prevent-assignment-in-a-single-line-if-statement
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.
It will be very easy when updated to eslint 9:)
src/containers/Header/Header.tsx
Outdated
| import React from 'react'; | ||
|
|
||
| import {Breadcrumbs} from '@gravity-ui/uikit'; | ||
| import _ from 'lodash'; |
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.
please import one function you need
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.
Done
src/containers/Header/Header.tsx
Outdated
| clusterName: clusterNameFinal, | ||
| }; | ||
| } | ||
| if (mainPage) rawBreadcrumbs.push(mainPage); |
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.
lets always use curly braces, like it is done all over the code. Once we update linters, we'll add a rule for this.
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.
Done (all over)
src/containers/Tablets/Tablets.tsx
Outdated
| return ( | ||
| <span> | ||
| {row.Type} {row.Leader ? <Text color="secondary">leader</Text> : ''} | ||
| {row.Type} {row.Leader ? '' : <Text color="secondary">follower</Text>} |
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.
Do you mind if we do it in separate PR?
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.
Nope
Done!
| const link = nodeId ? getDefaultNodePath(nodeId, query) : undefined; | ||
| const icon = isStorageNode ? <StorageNodeIcon /> : <ComputeNodeIcon />; | ||
| let text = headerKeyset('breadcrumbs.node'); | ||
| if (nodeId) text += ` ${nodeId}`; |
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.
please add curly braces
| : headerKeyset('breadcrumbs.pDisk'); | ||
| const link = pDiskId && nodeId ? getPDiskPagePath(pDiskId, nodeId, query) : undefined; | ||
| let text = headerKeyset('breadcrumbs.pDisk'); | ||
| if (pDiskId) text += ` ${pDiskId}`; |
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.
curly braces
| return rawBreadcrumbs; | ||
| } | ||
| } | ||
| if (!page) return rawBreadcrumbs; |
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.
curly braces
|
|
||
| return [...rawBreadcrumbs, ...getter(options, query)].map((item) => ({ | ||
| ...item, | ||
| action: () => {}, |
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.
let's return here raw breadcrumbs without action (cause you already add action in https://github.com/ydb-platform/ydb-embedded-ui/pull/913/files#diff-aa4640b8027696409b37009a150d396684a06d0dd3d7ec6c4abbeb6a74956480R51
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.
I guess this placement is more appropriate but actually not a big deal
Done
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.
Actually I agree with you. I meant that adding action should be done in one place :)
This reverts commit d7a7c9e.
src/containers/Header/Header.scss
Outdated
| color: var(--g-color-text-primary); | ||
| border-bottom: 1px solid var(--g-color-line-generic); | ||
|
|
||
| a { |
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.
Lets not define styles for html-tags, it's bad practice, that may lead to collisions and unwanted side-effects. Please use custom classNames.
src/containers/Header/Header.scss
Outdated
| } | ||
| } | ||
| &__breadcrumbs { | ||
| &_item { |
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.
Such notation is used for modifiers. For example: breadcrumbs_active or breadcrumbs_warning.
In this case it is an entity. Lets define it like &__breadcrumbs-item next to &__breadcrumbs (not inside it).
src/containers/Header/Header.scss
Outdated
| } | ||
|
|
||
| margin-right: 3px; | ||
| &_current { |
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.
And this is definitely a modifier!
src/containers/Header/Header.scss
Outdated
|
|
||
| &__icon { | ||
| display: flex; | ||
| &_icon { |
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.
This is an entity to. Lets define it like &__breadcrumbs-icon.
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.
In our code, we try to avoid more than one level of nesting (except for modifiers). This means that entities should follow each other and not be enclosed.
Changes are done, person is on vacation
No description provided.