Skip to content

Commit 6a9f57d

Browse files
author
tiltom
authored
Add SovrynLogo component (#75)
* Add SovrynLogo component * Fix review comments * Create big-nails-perform.md
1 parent 8c78881 commit 6a9f57d

5 files changed

Lines changed: 56 additions & 1 deletion

File tree

.changeset/big-nails-perform.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"frontend": patch
3+
---
4+
5+
SOV-826: Add SovrynLogo component
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React, { useMemo } from 'react';
2+
3+
import { applyDataAttr, LinkBase } from '@sovryn/ui';
4+
5+
import sovrynLogo from '../../../assets/images/sovryn-logo.svg';
6+
7+
type SovrynLogoProps = {
8+
image?: string;
9+
text?: string;
10+
link?: string;
11+
dataAttribute?: string;
12+
className?: string;
13+
};
14+
15+
export const SovrynLogo: React.FC<SovrynLogoProps> = ({
16+
image = sovrynLogo,
17+
text,
18+
link,
19+
dataAttribute,
20+
className,
21+
}) => {
22+
const Logo = useMemo(
23+
() => (
24+
<img
25+
src={image}
26+
className={className}
27+
alt={text}
28+
title={text}
29+
{...applyDataAttr(dataAttribute)}
30+
/>
31+
),
32+
[className, dataAttribute, image, text],
33+
);
34+
35+
return (
36+
<>
37+
{link ? (
38+
<LinkBase href={link} openNewTab={false}>
39+
{Logo}
40+
</LinkBase>
41+
) : (
42+
{ Logo }
43+
)}
44+
</>
45+
);
46+
};

apps/frontend/src/app/3_organisms/Header/Header.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '@sovryn/ui';
1111

1212
import { ConnectWalletButton } from '../../2_molecules';
13+
import { SovrynLogo } from '../../2_molecules/SovrynLogo/SovrynLogo';
1314
import { useWalletConnect } from '../../../hooks';
1415

1516
export const Header: FC = () => {
@@ -18,7 +19,7 @@ export const Header: FC = () => {
1819

1920
return (
2021
<UIHeader
21-
logo={<div>Sovryn</div>}
22+
logo={<SovrynLogo dataAttribute="logo" text="Sovryn" link="/" />}
2223
menuItems={
2324
<>
2425
<NavMenuItem className="mr-2" isActive children="Zero" />

apps/frontend/src/assets/.gitkeep

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)