Skip to content

Commit 06da705

Browse files
authored
Merge pull request #25 from keepsimpleio/chore/longevity-minor-improvements
Chore/longevity minor improvements
2 parents dca2e9a + 87f9141 commit 06da705

24 files changed

Lines changed: 121 additions & 69 deletions

File tree

711 KB
Loading
Binary file not shown.
7.37 KB
Loading
8.77 KB
Loading
Binary file not shown.

src/components/Navbar/Navbar.tsx

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const Navbar: FC<NavbarProps> = ({ handleToggleSidebar, handleClick }) => {
5959
logo: isDarkTheme ? <ToolsIcon /> : <ToolsDarkIcon />,
6060
target: '',
6161
id: 'tools',
62+
activeMatch: '/tools/longevity-protocol',
6263
},
6364
{
6465
name: articles,
@@ -81,31 +82,38 @@ const Navbar: FC<NavbarProps> = ({ handleToggleSidebar, handleClick }) => {
8182
[styles.authorized]: !!accountData,
8283
})}
8384
>
84-
{routes.map(({ name, path, target, logo, id }, index) => (
85-
<a
86-
key={index}
87-
href={path}
88-
target={target}
89-
onClick={e => {
90-
if (target === '_blank') return;
91-
e.preventDefault();
92-
if (isSmallScreen) handleToggleSidebar();
93-
handleClick(e, path);
94-
}}
95-
className={cn(styles.url, {
96-
[styles.active]:
97-
path === '/'
98-
? router.asPath === '/'
99-
: router.asPath.startsWith(path),
100-
[styles.uxcoreIcon]: id === 'uxcore',
101-
[styles.companyManagementIcon]: id === 'companyManagement',
102-
[styles.articlesIcon]: id === 'articles',
103-
[styles.ruUrl]: locale === 'ru',
104-
})}
105-
>
106-
{logo} {name}
107-
</a>
108-
))}
85+
{routes.map(({ name, path, target, logo, id, activeMatch }, index) => {
86+
const match = activeMatch ?? path;
87+
88+
const isActive =
89+
match === '/'
90+
? router.asPath === '/'
91+
: router.asPath.startsWith(match);
92+
93+
return (
94+
<a
95+
key={index}
96+
href={path}
97+
target={target}
98+
onClick={e => {
99+
if (target === '_blank') return;
100+
e.preventDefault();
101+
if (isSmallScreen) handleToggleSidebar();
102+
handleClick(e, path);
103+
}}
104+
className={cn(styles.url, {
105+
[styles.active]: isActive,
106+
[styles.uxcoreIcon]: id === 'uxcore',
107+
[styles.companyManagementIcon]: id === 'companyManagement',
108+
[styles.articlesIcon]: id === 'articles',
109+
[styles.ruUrl]: locale === 'ru',
110+
})}
111+
>
112+
{logo} {name}
113+
</a>
114+
);
115+
})}
116+
109117
<a
110118
href={'/contributors'}
111119
onClick={e => {

src/components/SeoGenerator/SeoGenerator.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface SeoGeneratorProps {
1313
localizedSlug?: any;
1414
modifiedDate?: string;
1515
createdDate?: string;
16+
isLongevityPage?: boolean;
1617
ogTags?: {
1718
ogDescription: string;
1819
ogTitle: string;
@@ -38,6 +39,7 @@ const SeoGenerator: FC<SeoGeneratorProps> = ({
3839
createdDate,
3940
modifiedDate,
4041
localizedSlug,
42+
isLongevityPage,
4143
}) => {
4244
const router = useRouter();
4345

@@ -224,7 +226,9 @@ const SeoGenerator: FC<SeoGeneratorProps> = ({
224226
property="og:image"
225227
content={
226228
ogTags?.ogImage?.data?.attributes?.url
227-
? `${process.env.NEXT_PUBLIC_STRAPI}${ogTags?.ogImage?.data?.attributes?.url}`
229+
? isLongevityPage
230+
? ogTags?.ogImage?.data?.attributes?.url
231+
: `${process.env.NEXT_PUBLIC_STRAPI}${ogTags?.ogImage?.data?.attributes?.url}`
228232
: ogTags?.ogImage?.data?.attributes?.staticUrl
229233
}
230234
/>
@@ -254,7 +258,9 @@ const SeoGenerator: FC<SeoGeneratorProps> = ({
254258
name="twitter:image"
255259
content={
256260
ogTags?.ogImage?.data?.attributes?.url
257-
? `${process.env.NEXT_PUBLIC_STRAPI}${ogTags?.ogImage?.data?.attributes?.url}`
261+
? isLongevityPage
262+
? ogTags?.ogImage?.data?.attributes?.url
263+
: `${process.env.NEXT_PUBLIC_STRAPI}${ogTags?.ogImage?.data?.attributes?.url}`
258264
: ogTags?.ogImage?.data?.attributes?.staticUrl
259265
}
260266
/>

src/components/longevity/LongevitySubSection/LongevitySubSection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const LongevitySubSection: FC<LongevitySubSectionProps> = ({
7171
id={title}
7272
place={'bottom'}
7373
className={cn(styles.tooltip, {})}
74+
clickable
7475
>
7576
<WhyDoThisTooltip
7677
whatDamagesText={whatDamages}

src/components/longevity/Navigation/Navigation.module.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
.subItem {
1212
background-image: url('/keepsimple_/assets/longevity/nav-bg.svg');
1313
background-repeat: no-repeat;
14-
background-size: contain;
14+
background-size: cover;
1515
width: 222px;
1616
height: 49px;
1717
text-align: center;
@@ -50,7 +50,7 @@
5050
text-decoration: none;
5151
cursor: pointer;
5252
background-image: url('/keepsimple_/assets/longevity/nav-hover-bg.png');
53-
53+
background-size: cover;
5454
.subLink,
5555
.link {
5656
color: #fff;
@@ -64,6 +64,7 @@
6464

6565
&:hover {
6666
cursor: pointer;
67+
6768
background-image: url('/keepsimple_/assets/longevity/nav-hover-bg.png');
6869
}
6970
}

src/components/longevity/Navigation/Navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const Navigation: FC = () => {
104104
width={1140}
105105
height={83}
106106
className={cn(styles.curtains, {
107-
[styles.curtainsOpen]: router.pathname.includes('habits'),
107+
[styles.curtainsOpen]: !router.asPath.includes('about-project'),
108108
})}
109109
/>
110110
<ul className={styles.subUl}>

0 commit comments

Comments
 (0)