Skip to content

Commit 62dac29

Browse files
committed
feat(web-devtools): tooltip-for-different-sections
1 parent 2c62886 commit 62dac29

File tree

6 files changed

+76
-5
lines changed

6 files changed

+76
-5
lines changed

web-devtools/src/app/(main)/ruler/ChangeDeveloper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const ChangeDeveloper: React.FC = () => {
7777
);
7878
return (
7979
<Container>
80-
<Header text="Developer" />
80+
<Header text="Developer" tooltipMsg="Address of the current ruler of the selected arbitrable" />
8181
<InputContainer>
8282
<StyledLabel>Current Developer : {currentDeveloper ?? "None"}</StyledLabel>
8383
<LabeledInput
Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
import React from "react";
22
import styled from "styled-components";
3+
import WithHelpTooltip from "components/WithHelpTooltip";
34

4-
const Container = styled.h2`
5+
const Container = styled.div`
6+
width: 100%;
7+
display: flex;
8+
align-items: center;
59
border-bottom: 1px solid ${({ theme }) => theme.klerosUIComponentsStroke};
610
padding: 8px 0px;
711
`;
812

9-
const Header: React.FC<{ text: string }> = ({ text }) => <Container>{text}</Container>;
13+
const Title = styled.h2`
14+
margin: 0;
15+
`;
16+
17+
const Header: React.FC<{ text: string; tooltipMsg: string }> = ({ text, tooltipMsg }) => (
18+
<Container>
19+
<WithHelpTooltip tooltipMsg={tooltipMsg} place="right">
20+
<Title>{text}</Title>
21+
</WithHelpTooltip>
22+
</Container>
23+
);
1024

1125
export default Header;

web-devtools/src/app/(main)/ruler/ManualRuling.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ const ManualRuling: React.FC = () => {
102102

103103
return (
104104
<Container>
105-
<Header text="Manual Ruling" />
105+
<Header
106+
text="Manual Ruling"
107+
tooltipMsg="Provide Manual ruling for the arbitrator. This operation will change the ruling mode to Manual, if the ruling mode is not Manual"
108+
/>
106109
<SelectContainer>
107110
<LabeledInput
108111
label="Dispute ID"

web-devtools/src/app/(main)/ruler/RulingModes.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ const RulingModes: React.FC = () => {
212212

213213
return (
214214
<Container>
215-
<Header text="Ruling Mode" />
215+
<Header
216+
text="Ruling Mode"
217+
tooltipMsg="Current Ruling mode of the arbitrator. Learn more about ruling modes here."
218+
/>
216219
<StyledLabel>
217220
Current mode: <small>{getRulingModeText(arbitrableSettings?.rulingMode)}</small>
218221
</StyledLabel>
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
4+
import { Tooltip } from "@kleros/ui-components-library";
5+
6+
import _HelpIcon from "svgs/icons/help.svg";
7+
8+
import { landscapeStyle } from "styles/landscapeStyle";
9+
10+
const Container = styled.div`
11+
display: flex;
12+
align-items: center;
13+
`;
14+
15+
const HelpIcon = styled(_HelpIcon)`
16+
display: flex;
17+
align-items: center;
18+
height: 12px;
19+
width: 12px;
20+
fill: ${({ theme }) => theme.klerosUIComponentsSecondaryText};
21+
margin: 0 0 0 8px;
22+
23+
${landscapeStyle(
24+
() => css`
25+
height: 14px;
26+
width: 14px;
27+
`
28+
)}
29+
`;
30+
31+
interface IWithHelpTooltip {
32+
tooltipMsg: string;
33+
place?: "bottom" | "left" | "right" | "top";
34+
children?: React.ReactNode;
35+
}
36+
37+
const WithHelpTooltip: React.FC<IWithHelpTooltip> = ({ tooltipMsg, children, place }) => (
38+
<Container>
39+
{children}
40+
<Tooltip small text={tooltipMsg} {...{ place }}>
41+
<HelpIcon />
42+
</Tooltip>
43+
</Container>
44+
);
45+
46+
export default WithHelpTooltip;

0 commit comments

Comments
 (0)