Skip to content

Commit

Permalink
Merge pull request #2324 from daostack/bugfix/CW-2318-avatar-blinking
Browse files Browse the repository at this point in the history
Blinking space's letters avatar on loading #2318
  • Loading branch information
andreymikhadyuk authored Nov 20, 2023
2 parents f7898a3 + 6076e6b commit 87f0bb7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { FC } from "react";
import { NavLink } from "react-router-dom";
import classNames from "classnames";
import { useRoutesContext } from "@/shared/contexts";
import { useIsTabletView } from "@/shared/hooks/viewport";
import { SidebarIcon, StarIcon } from "@/shared/icons";
import { CommonAvatar, TopNavigationOpenSidenavButton } from "@/shared/ui-kit";
import { getPluralEnding } from "@/shared/utils";
import { ContentWrapper } from "./components";
import styles from "./HeaderCommonContent.module.scss";

interface HeaderCommonContentProps {
Expand All @@ -26,28 +24,14 @@ const HeaderCommonContent: FC<HeaderCommonContentProps> = (props) => {
memberCount,
showFollowIcon = false,
} = props;
const { getCommonPageAboutTabPath } = useRoutesContext();
const isTabletView = useIsTabletView();

const ContentWrapper: FC = ({ children }) =>
isTabletView ? (
<div className={styles.commonLink}>{children}</div>
) : (
<NavLink
className={styles.commonLink}
to={getCommonPageAboutTabPath(commonId)}
>
{children}
</NavLink>
);

return (
<div className={styles.container}>
<TopNavigationOpenSidenavButton
className={styles.openSidenavButton}
iconEl={<SidebarIcon className={styles.openSidenavIcon} />}
/>
<ContentWrapper>
<ContentWrapper className={styles.commonLink} commonId={commonId}>
<CommonAvatar
name={commonName}
src={commonImage}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, { FC } from "react";
import { NavLink } from "react-router-dom";
import { useRoutesContext } from "@/shared/contexts";
import { useIsTabletView } from "@/shared/hooks/viewport";

interface ContentWrapperProps {
className?: string;
commonId: string;
}

const ContentWrapper: FC<ContentWrapperProps> = (props) => {
const { className, commonId, children } = props;
const isTabletView = useIsTabletView();
const { getCommonPageAboutTabPath } = useRoutesContext();

return isTabletView ? (
<div className={className}>{children}</div>
) : (
<NavLink className={className} to={getCommonPageAboutTabPath(commonId)}>
{children}
</NavLink>
);
};

export default ContentWrapper;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ContentWrapper } from "./ContentWrapper";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ContentWrapper";

0 comments on commit 87f0bb7

Please sign in to comment.