Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit f160a3c

Browse files
authored
TILA-1211 tooltips (#381)
* layout tweaks * TILA-1211 tooltips * TILA-1853 text changes * TILA-1855 hide messages for preliminary reservation behind expand link
1 parent 4abbcf2 commit f160a3c

11 files changed

Lines changed: 673 additions & 191 deletions

File tree

admin-ui/src/component/ReservationUnits/ReservationUnitEditor/ActivationGroup.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,30 @@ import { Checkbox } from "hds-react";
33
import styled from "styled-components";
44

55
const Indent = styled.div<{ $noIndent: boolean }>`
6-
margin-top: var(--spacing-m);
76
${({ $noIndent }) => ($noIndent ? null : `margin-left: var(--spacing-l);`)}
87
`;
98

9+
const Wrapper = styled.div<{ $noMargin: boolean }>`
10+
${({ $noMargin }) => ($noMargin ? null : `margin-top: var(--spacing-s);`)}
11+
`;
12+
13+
Wrapper.displayName = "Wrapper";
14+
1015
const ActivationGroup = ({
1116
id,
1217
label,
1318
initiallyOpen,
1419
children,
1520
noIndent = false,
21+
noMargin = false,
1622
onClose,
1723
}: {
1824
id: string;
1925
label: string;
2026
initiallyOpen: boolean;
2127
children: React.ReactChild | React.ReactChild[];
2228
noIndent?: boolean;
29+
noMargin?: boolean;
2330
onClose?: () => void;
2431
}): JSX.Element => {
2532
const [open, setOpen] = useState(initiallyOpen);
@@ -37,7 +44,12 @@ const ActivationGroup = ({
3744
}
3845
}}
3946
/>
40-
{open ? <Indent $noIndent={noIndent}>{children}</Indent> : null}
47+
48+
{open ? (
49+
<Wrapper $noMargin={noMargin}>
50+
<Indent $noIndent={noIndent}>{children}</Indent>
51+
</Wrapper>
52+
) : null}
4153
</>
4254
);
4355
};

admin-ui/src/component/ReservationUnits/ReservationUnitEditor/EnumSelect.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const EnumSelect = <T,>({
2727
value,
2828
type,
2929
errorText,
30+
tooltipText,
3031
sort = false,
3132
}: {
3233
id: string;
@@ -38,6 +39,7 @@ const EnumSelect = <T,>({
3839
onChange: (value: T) => void;
3940
type: { [key: string]: string };
4041
errorText?: string;
42+
tooltipText?: string;
4143
sort?: boolean;
4244
}): JSX.Element => {
4345
const { t } = useTranslation();
@@ -65,6 +67,7 @@ const EnumSelect = <T,>({
6567
error={errorText}
6668
invalid={!!errorText}
6769
sort={sort}
70+
tooltipText={tooltipText}
6871
/>
6972
</>
7073
);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Tooltip } from "hds-react";
2+
import React from "react";
3+
import { HorisontalFlex } from "../../../styles/layout";
4+
import { Strong } from "../../../styles/util";
5+
6+
export type Props = {
7+
heading: string;
8+
tooltip?: string;
9+
id?: string;
10+
children?: React.ReactNode;
11+
};
12+
const FieldGroup = ({
13+
children,
14+
id,
15+
heading,
16+
tooltip = "",
17+
}: Props): JSX.Element => (
18+
<HorisontalFlex
19+
style={{
20+
justifyContent: "space-between",
21+
width: "100%",
22+
}}
23+
>
24+
<span>
25+
<Strong style={{ display: "block", paddingBottom: "var(--spacing-xs)" }}>
26+
{heading}
27+
</Strong>
28+
{id ? <span id={id} /> : null}
29+
{children}
30+
</span>
31+
<Tooltip>{tooltip}</Tooltip>
32+
</HorisontalFlex>
33+
);
34+
35+
export default FieldGroup;

admin-ui/src/component/ReservationUnits/ReservationUnitEditor/ImageEditor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ const ImageEditor = ({ images, setImages }: Props): JSX.Element => {
146146
dragAndDropInputLabel=" "
147147
maxSize={5242880}
148148
onChange={(files) => addImage(files)}
149+
tooltipText={t("ReservationUnitEditor.tooltip.images")}
149150
/>
150151
</FileInputContainer>
151152
</div>

0 commit comments

Comments
 (0)