Skip to content

Conversation

@NaiSidera
Copy link
Contributor

No description provided.

@NaiSidera NaiSidera requested a review from artemmufazalov June 13, 2024 13:31
@artemmufazalov artemmufazalov linked an issue Jun 13, 2024 that may be closed by this pull request
}
}

.g-breadcrumbs {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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:)

import React from 'react';

import {Breadcrumbs} from '@gravity-ui/uikit';
import _ from 'lodash';
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

clusterName: clusterNameFinal,
};
}
if (mainPage) rawBreadcrumbs.push(mainPage);
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (all over)

return (
<span>
{row.Type} {row.Leader ? <Text color="secondary">leader</Text> : ''}
{row.Type} {row.Leader ? '' : <Text color="secondary">follower</Text>}
Copy link
Contributor

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?

Copy link
Contributor Author

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}`;
Copy link
Contributor

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}`;
Copy link
Contributor

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;
Copy link
Contributor

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: () => {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

Copy link
Contributor

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 :)

color: var(--g-color-text-primary);
border-bottom: 1px solid var(--g-color-line-generic);

a {
Copy link
Contributor

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.

}
}
&__breadcrumbs {
&_item {
Copy link
Contributor

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).

}

margin-right: 3px;
&_current {
Copy link
Contributor

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!


&__icon {
display: flex;
&_icon {
Copy link
Contributor

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.

Copy link
Contributor

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.

@NaiSidera NaiSidera dismissed artemmufazalov’s stale review June 20, 2024 09:54

Changes are done, person is on vacation

@NaiSidera NaiSidera merged commit cdf36da into main Jun 20, 2024
@NaiSidera NaiSidera deleted the 615-use-link-for-breadcrumbs branch June 20, 2024 09:54
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

Successfully merging this pull request may close these issues.

Make breadcrumbs links

4 participants