Skip to content

Commit

Permalink
Add Tooltips to the logos in the 'Our Allies' section of the About page
Browse files Browse the repository at this point in the history
  • Loading branch information
SARodrigues committed Jan 24, 2024
1 parent fbf46b8 commit 330e7ad
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 16 deletions.
18 changes: 3 additions & 15 deletions frontend/containers/about/our-allies/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import cx from 'classnames';
import Image from 'next/image';

import { useAlliesLogos, useSupportedByLogos } from './data';
import Logo from './logo/component';

export const OurAllies = () => {
const alliesLogos = useAlliesLogos();
Expand All @@ -27,16 +28,7 @@ export const OurAllies = () => {
})}
>
{row.map((logo) => {
return (
<span key={logo.src}>
<Image
src={logo.src}
width={logo.width}
height={logo.height}
alt={logo.alt}
/>
</span>
);
return <Logo key={logo.src} logo={logo} />;
})}
</div>
);
Expand All @@ -50,11 +42,7 @@ export const OurAllies = () => {
<div className="flex flex-col mt-8">
<div className="flex flex-wrap items-center justify-center gap-6">
{supportedByLogos.map((logo) => {
return (
<span key={logo.src}>
<Image src={logo.src} width={logo.width} height={logo.height} alt={logo.alt} />
</span>
);
return <Logo key={logo.src} logo={logo} />;
})}
</div>
</div>
Expand Down
29 changes: 29 additions & 0 deletions frontend/containers/about/our-allies/logo/component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { FC } from 'react';

import Image from 'next/image';

import Tooltip from 'components/tooltip';

import { OurAlliesLogoType } from './';

export const OurAlliesLogo: FC<OurAlliesLogoType> = ({ logo }) => {
return (
<span>
<Tooltip
arrow
arrowClassName="bg-black"
content={
<div className="max-w-xs p-2 font-sans text-sm font-normal text-white bg-black rounded-sm">
{logo.alt}
</div>
}
>
<span className="flex py-1 sm:py-0">
<Image src={logo.src} width={logo.width} height={logo.height} alt={logo.alt} />
</span>
</Tooltip>
</span>
);
};

export default OurAlliesLogo;
2 changes: 2 additions & 0 deletions frontend/containers/about/our-allies/logo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type { OurAlliesLogoType } from './types';
export { default } from './component';
8 changes: 8 additions & 0 deletions frontend/containers/about/our-allies/logo/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type OurAlliesLogoType = {
logo: {
src: string;
width: number;
height: number;
alt: string;
};
};
2 changes: 1 addition & 1 deletion frontend/containers/sdgs/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const SDGs: FC<SDGsProps> = ({ className, size = 'small', sdgs = [] }: SD
arrowClassName="bg-black"
content={
<div className="max-w-xs p-2 font-sans text-sm font-normal text-white bg-black rounded-sm">
{sdg.name}
haha
</div>
}
>
Expand Down

0 comments on commit 330e7ad

Please sign in to comment.