The Node.js® Website
1'use client';
2
3import Image from 'next/image';
4import { useTranslations } from 'next-intl';
5import { useTheme } from 'next-themes';
6import { useEffect, useState } from 'react';
7
8import styles from './index.module.css';
9
10const getLogoURL = (theme: string = 'dark') =>
11 `https://website-assets.oramasearch.com/orama-when-${theme}.svg`;
12
13export const WithPoweredBy = () => {
14 const t = useTranslations();
15 const { resolvedTheme } = useTheme();
16 const [logoURL, setLogoURL] = useState<string>();
17
18 useEffect(() => setLogoURL(getLogoURL(resolvedTheme)), [resolvedTheme]);
19
20 return (
21 <div className={styles.poweredBy}>
22 {t('components.search.poweredBy.text')}
23
24 <a
25 href="https://oramasearch.com?utm_source=nodejs.org"
26 target="_blank"
27 rel="noreferer"
28 >
29 {logoURL && (
30 <Image
31 src={logoURL}
32 alt="Powered by OramaSearch"
33 className={styles.poweredByLogo}
34 width={80}
35 height={20}
36 />
37 )}
38 </a>
39 </div>
40 );
41};