mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15: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 { Button, ButtonAddons, Icon, Level, urls } from "@scm-manager/ui-components";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const MarginIcon = styled(Icon)`
|
||||
padding-right: 0.5rem;
|
||||
@@ -58,11 +59,12 @@ const RepositoryFormButton: FC<RepositoryForm> = ({ path, icon, label }) => {
|
||||
const location = useLocation();
|
||||
const href = urls.concat("/repos/create", path);
|
||||
const isSelected = href === location.pathname;
|
||||
const [t] = useTranslation(["repos", "plugins"]);
|
||||
|
||||
return (
|
||||
<SmallButton color={isSelected ? "link is-selected" : undefined} link={!isSelected ? href : undefined}>
|
||||
<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>
|
||||
);
|
||||
};
|
||||
@@ -75,7 +77,7 @@ const RepositoryFormSwitcher: FC<Props> = ({ forms }) => (
|
||||
<TopLevel
|
||||
right={
|
||||
<ButtonAddons>
|
||||
{(forms || []).map(form => (
|
||||
{(forms || []).map((form) => (
|
||||
<RepositoryFormButton key={form.path} {...form} />
|
||||
))}
|
||||
</ButtonAddons>
|
||||
|
||||
Reference in New Issue
Block a user