mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
fix repository form switcher button label translations for plugins
This commit is contained in:
@@ -26,6 +26,7 @@ import React, { FC } from "react";
|
|||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { Button, ButtonAddons, Icon, Level, urls } from "@scm-manager/ui-components";
|
import { Button, ButtonAddons, Icon, Level, urls } from "@scm-manager/ui-components";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const MarginIcon = styled(Icon)`
|
const MarginIcon = styled(Icon)`
|
||||||
padding-right: 0.5rem;
|
padding-right: 0.5rem;
|
||||||
@@ -58,11 +59,12 @@ const RepositoryFormButton: FC<RepositoryForm> = ({ path, icon, label }) => {
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const href = urls.concat("/repos/create", path);
|
const href = urls.concat("/repos/create", path);
|
||||||
const isSelected = href === location.pathname;
|
const isSelected = href === location.pathname;
|
||||||
|
const [t] = useTranslation(["repos", "plugins"]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SmallButton color={isSelected ? "link is-selected" : undefined} link={!isSelected ? href : undefined}>
|
<SmallButton color={isSelected ? "link is-selected" : undefined} link={!isSelected ? href : undefined}>
|
||||||
<MarginIcon name={icon} color={isSelected ? "white" : "default"} />
|
<MarginIcon name={icon} color={isSelected ? "white" : "default"} />
|
||||||
<p className="is-hidden-mobile is-hidden-tablet-only">{label}</p>
|
<p className="is-hidden-mobile is-hidden-tablet-only">{t(`plugins:${label}`, label)}</p>
|
||||||
</SmallButton>
|
</SmallButton>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -75,7 +77,7 @@ const RepositoryFormSwitcher: FC<Props> = ({ forms }) => (
|
|||||||
<TopLevel
|
<TopLevel
|
||||||
right={
|
right={
|
||||||
<ButtonAddons>
|
<ButtonAddons>
|
||||||
{(forms || []).map(form => (
|
{(forms || []).map((form) => (
|
||||||
<RepositoryFormButton key={form.path} {...form} />
|
<RepositoryFormButton key={form.path} {...form} />
|
||||||
))}
|
))}
|
||||||
</ButtonAddons>
|
</ButtonAddons>
|
||||||
|
|||||||
Reference in New Issue
Block a user