Skip to content

Commit

Permalink
Merge pull request #2215 from bakdata/feature/fix-input-range-header-…
Browse files Browse the repository at this point in the history
…styles

Fix input range header style - reuse Label
  • Loading branch information
Kadrian authored Nov 17, 2021
2 parents 7a5bd5c + 55e7e72 commit 2ceef5c
Showing 1 changed file with 4 additions and 11 deletions.
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

0 comments on commit 2ceef5c

Please sign in to comment.