Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix input range header style - reuse Label #2215

Merged
merged 1 commit into from
Nov 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions frontend/src/js/ui-components/InputRangeHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import styled from "@emotion/styled";
import { FC } from "react";

import { IndexPrefix } from "../common/components/IndexPrefix";
import { exists } from "../common/helpers/exists";
import InfoTooltip from "../tooltip/InfoTooltip";

import Label from "./Label";

interface PropsT {
className?: string;
label: string;
Expand All @@ -14,14 +15,6 @@ interface PropsT {
disabled?: boolean;
}

const Container = styled("p")<{ disabled?: boolean }>`
font-size: ${({ theme }) => theme.font.sm};
margin: 6px 0 3px;
color: ${({ theme, disabled }) => (disabled ? theme.col.gray : "initial")};
display: flex;
align-items: center;
`;

const InputRangeHeader: FC<PropsT> = ({
label,
indexPrefix,
Expand All @@ -31,12 +24,12 @@ const InputRangeHeader: FC<PropsT> = ({
disabled,
}) => {
return (
<Container className={className} disabled={disabled}>
<Label className={className} disabled={disabled}>
{exists(indexPrefix) && <IndexPrefix># {indexPrefix}</IndexPrefix>}
{label}
{unit && ` ( ${unit} )`}
{tooltip && <InfoTooltip text={tooltip} />}
</Container>
</Label>
);
};

Expand Down