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

fixed Selector z index in light theme #568

Merged
merged 6 commits into from
Jan 20, 2025
Merged
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
1 change: 1 addition & 0 deletions src/Components/Selector/Selector.less
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

.dropdown {
position: absolute;
z-index: 2;
border: 1px solid #e4e4e4;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
background-color: var(--search-selector);
Expand Down
17 changes: 16 additions & 1 deletion src/Components/TagListItem/TagListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, FC } from "react";
import React, { useState, FC, useEffect, useRef } from "react";
import flatten from "lodash/flatten";
import { Button } from "@skbkontur/react-ui/components/Button";
import OkIcon from "@skbkontur/react-icons/Ok";
Expand Down Expand Up @@ -123,6 +123,10 @@ export const TagListItem: FC<ItemProps> = ({
const [deleteTag] = useDeleteTagMutation();
const { name, subscriptions, triggers } = tagStat;

const itemRef = useRef<HTMLDivElement | null>(null);

const isLastTag = tags[tags.length - 1] === name;

const hasSubscriptions = subscriptions.length !== 0;

const handleSubscriptionClick = (
Expand Down Expand Up @@ -155,8 +159,19 @@ export const TagListItem: FC<ItemProps> = ({
? SUBSCRIPTION_LIST_HEIGHT
: getTotalItemSize(subscriptionContactsCount);

// if last tag in the list has subs, open the subs list and scroll to the center, cause on Mac OS there is now visual difference and scroll bar only shows up when explicitly move mouse on the list
useEffect(() => {
if (isActive && isLastTag && hasSubscriptions && itemRef.current) {
itemRef.current.scrollIntoView({
behavior: "smooth",
block: "center",
});
}
}, [isActive]);

return (
<div
ref={itemRef}
style={style}
className={cn("row", {
active: isActive && hasSubscriptions,
Expand Down
17 changes: 8 additions & 9 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import ReactDOM from "react-dom";
import { BrowserRouter } from "react-router-dom";
import checkMobile from "./helpers/check-mobile";
import * as Sentry from "@sentry/react";
import ErrorContainer from "./Containers/ErrorContainer";
import { Providers } from "./Providers/Providers";
import SentryInitializer from "./Components/SentryInitializer/SentryInitializer";
import * as serviceWorkerRegistration from "./serviceWorkerRegistration";
import { updateServiceWorker } from "./store/Reducers/UIReducer.slice";
import { store } from "./store/store";
import { Toast } from "@skbkontur/react-ui/components/Toast";
import Favicon from "./Components/Favicon/Favicon";

import "./style.less";
Expand All @@ -23,17 +23,16 @@ const render = (Component: ComponentType) => {
if (root !== null) {
ReactDOM.render(
<BrowserRouter>
<Sentry.ErrorBoundary
fallback={({ error, componentStack }) => (
<ErrorContainer title={error.toString()} message={componentStack} />
)}
>
<Providers>
<Providers>
<Sentry.ErrorBoundary
onError={(error) => Toast.push(error.toString())}
fallback={() => <Component />}
>
<SentryInitializer />
<Favicon />
<Component />
</Providers>
</Sentry.ErrorBoundary>
</Sentry.ErrorBoundary>
</Providers>
</BrowserRouter>,
root
);
Expand Down
Loading