Skip to content

Commit

Permalink
Merge pull request #107 from ahmed-deriv/ahmed/DAPI-710/fix--internal…
Browse files Browse the repository at this point in the history
…-link-navigate-with-translation

ahmed/DAPI-710/fix--internal-link-navigate-with-translation
  • Loading branch information
sandeep-deriv authored Aug 30, 2024
2 parents 026057f + 9015627 commit 4a42ac1
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ const Footer = () => {
i18n: { currentLocale },
} = useDocusaurusContext();

const external_links = React.useMemo(() => {
const footer_links = React.useMemo(() => {
const is_en = currentLocale === 'en';
const get_url = (path: string) =>
`https://deriv.com${!is_en ? `/${currentLocale}` : ''}/${path}`;
const get_url = (path: string, isExternal = true) => {
const pathInfo = `${!is_en ? `/${currentLocale}` : ''}/${path}`;
return isExternal ? `https://deriv.com${pathInfo}` : pathInfo;
};
return {
root: get_url(''),
who_we_are: get_url('who-we-are'),
contact_us: get_url('contact-us'),
documentation: get_url('docs/intro', false),
dashboard: get_url('dashboard', false),
api_explorer: get_url('api-explorer', false),
};
}, [currentLocale]);

Expand All @@ -31,17 +36,17 @@ const Footer = () => {
content: (
<ul className={styles.List}>
<li>
<a href='/docs/intro' className={styles.Link}>
<a href={footer_links.documentation} className={styles.Link}>
<Translate>Documentation</Translate>
</a>
</li>
<li>
<a href='/dashboard' className={styles.Link}>
<a href={footer_links.dashboard} className={styles.Link}>
<Translate>Dashboard</Translate>
</a>
</li>
<li>
<a href='/api-explorer' className={styles.Link}>
<a href={footer_links.api_explorer} className={styles.Link}>
<Translate>API explorer</Translate>
</a>
</li>
Expand All @@ -63,17 +68,17 @@ const Footer = () => {
content: (
<ul className={styles.List}>
<li>
<a href={external_links.root} target='blank' className={styles.Link}>
<a href={footer_links.root} target='blank' className={styles.Link}>
<LabelPairedArrowUpRightSmRegularIcon /> <Translate>Homepage</Translate>
</a>
</li>
<li>
<a href={external_links.who_we_are} target='blank' className={styles.Link}>
<a href={footer_links.who_we_are} target='blank' className={styles.Link}>
<LabelPairedArrowUpRightSmRegularIcon /> <Translate>Who we are</Translate>
</a>
</li>
<li>
<a href={external_links.contact_us} target='blank' className={styles.Link}>
<a href={footer_links.contact_us} target='blank' className={styles.Link}>
<LabelPairedArrowUpRightSmRegularIcon /> <Translate>Contact us</Translate>
</a>
</li>
Expand All @@ -100,17 +105,17 @@ const Footer = () => {
</Text>
<ul className={styles.List}>
<li>
<a href='/docs/intro' className={styles.Link}>
<a href={footer_links.documentation} className={styles.Link}>
<Translate>Documentation</Translate>
</a>
</li>
<li>
<a href='/dashboard' className={styles.Link}>
<a href={footer_links.dashboard} className={styles.Link}>
<Translate>Dashboard</Translate>
</a>
</li>
<li>
<a href='/api-explorer' className={styles.Link}>
<a href={footer_links.api_explorer} className={styles.Link}>
<Translate>API explorer</Translate>
</a>
</li>
Expand All @@ -136,17 +141,17 @@ const Footer = () => {
</Text>
<ul className={styles.List}>
<li>
<a href={external_links.root} target='blank' className={styles.Link}>
<a href={footer_links.root} target='blank' className={styles.Link}>
<LabelPairedArrowUpRightSmRegularIcon /> <Translate>Homepage</Translate>
</a>
</li>
<li>
<a href={external_links.who_we_are} target='blank' className={styles.Link}>
<a href={footer_links.who_we_are} target='blank' className={styles.Link}>
<LabelPairedArrowUpRightSmRegularIcon /> <Translate>Who we are</Translate>
</a>
</li>
<li>
<a href={external_links.contact_us} target='blank' className={styles.Link}>
<a href={footer_links.contact_us} target='blank' className={styles.Link}>
<LabelPairedArrowUpRightSmRegularIcon /> <Translate>Contact us</Translate>
</a>
</li>
Expand Down

0 comments on commit 4a42ac1

Please sign in to comment.