Add class to current selected language.
alexmf23 opened this issue · 0 comments
alexmf23 commented
Hello,
I'm using this code to display the languages
import {Link, useI18next} from 'gatsby-plugin-react-i18next';
import PropTypes from 'prop-types';
import React from 'react';
const Header = ({siteTitle}) => {
const {languages, originalPath} = useI18next();
return (
<header className="main-header">
<h1 style={{margin: 0}}>
<Link
to="/"
style={{
color: `white`,
textDecoration: `none`
}}>
{siteTitle}
</Link>
</h1>
<ul className="languages">
{languages.map((lng) => (
<li key={lng}>
<Link to={originalPath} language={lng}>
{lng}
</Link>
</li>
))}
</ul>
</header>
);
};
How can I add an active class to the current selected language ?