Skip to content

Commit 6a67feb

Browse files
authored
Merge pull request #619 from AllenInstitute/feature/refactor-new-button-style
Refactor icon buttons to use new component
2 parents a2e080b + 2fc3cdb commit 6a67feb

File tree

10 files changed

+38
-86
lines changed

10 files changed

+38
-86
lines changed

packages/core/components/DataSourcePrompt/DataSourcePrompt.module.css

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@
6565
}
6666

6767
.icon-button {
68-
background-color: transparent;
69-
color: var(--primary-text-color);
7068
top: -6px;
7169
}
7270

@@ -75,11 +73,6 @@
7573
height: 18px;
7674
}
7775

78-
.icon-button:hover {
79-
background-color: transparent;
80-
color: var(--highlight-text-color);
81-
}
82-
8376
.load-button-container {
8477
display: flex;
8578
margin-top: 18px;

packages/core/components/DataSourcePrompt/FilePrompt.module.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,9 @@
7575
}
7676

7777
.selected-file-button {
78-
color: var(--primary-text-color);
7978
margin-left: 10px;
8079
}
8180

82-
.selected-file-button:hover {
83-
background-color: unset;
84-
color: var(--highlight-text-color);
85-
}
86-
8781
.selected-files {
8882
align-items: center;
8983
display: flex;

packages/core/components/DataSourcePrompt/FilePrompt.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Icon, IconButton, TextField } from "@fluentui/react";
1+
import { Icon, TextField } from "@fluentui/react";
22
import classNames from "classnames";
33
import { throttle } from "lodash";
44
import * as React from "react";
55
import { useDropzone } from "react-dropzone";
66

7-
import { SecondaryButton, TertiaryButton } from "../Buttons";
7+
import { SecondaryButton, TertiaryButton, TransparentIconButton } from "../Buttons";
88
import Tooltip from "../Tooltip";
99
import { Source, getNameAndTypeFromSourceUrl } from "../../entity/SearchParams";
1010

@@ -97,9 +97,10 @@ export default function FilePrompt(props: Props) {
9797
{props.selectedFile.name}.{props.selectedFile.type}
9898
</p>
9999
</Tooltip>
100-
<IconButton
100+
<TransparentIconButton
101101
className={styles.selectedFileButton}
102-
iconProps={{ iconName: "Cancel" }}
102+
iconName="Cancel"
103+
title="Remove file"
103104
onClick={() => props.onSelectFile(undefined)}
104105
/>
105106
</div>

packages/core/components/DataSourcePrompt/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { DefaultButton, Icon, IconButton } from "@fluentui/react";
1+
import { DefaultButton, Icon } from "@fluentui/react";
22
import classNames from "classnames";
33
import * as React from "react";
44
import { useDispatch, useSelector } from "react-redux";
55

66
import FilePrompt from "./FilePrompt";
7-
import { LinkLikeButton, PrimaryButton } from "../Buttons";
7+
import { LinkLikeButton, PrimaryButton, TransparentIconButton } from "../Buttons";
88
import { Source } from "../../entity/SearchParams";
99
import { interaction, selection } from "../../state";
1010
import { DataSourcePromptInfo } from "../../state/interaction/actions";
@@ -77,9 +77,9 @@ export default function DataSourcePrompt(props: Props) {
7777
{!metadataSource && (
7878
<div className={styles.advancedOptionsHeader}>
7979
<h4 className={styles.fullWidth}>Add metadata descriptor file (optional)</h4>
80-
<IconButton
80+
<TransparentIconButton
8181
className={styles.iconButton}
82-
iconProps={{ iconName: "Cancel" }}
82+
iconName="Cancel"
8383
onClick={() => {
8484
setMetadataSource(undefined);
8585
setShowAdvancedOptions(false);

packages/core/components/EditMetadata/EditMetadata.module.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,9 @@
138138
}
139139

140140
.selected-option-button {
141-
color: var(--primary-text-color);
142141
margin-left: 10px;
143142
}
144143

145-
.selected-option-button:hover {
146-
background-color: unset;
147-
color: var(--highlight-text-color);
148-
}
149-
150144
.text-field {
151145
padding-bottom: var(--margin);
152146
width: var(--edit-form-field-width);

packages/core/components/EditMetadata/NewAnnotationPathway.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { IconButton, Stack, StackItem, TextField } from "@fluentui/react";
1+
import { Stack, StackItem, TextField } from "@fluentui/react";
22
import classNames from "classnames";
33
import Fuse from "fuse.js";
44
import * as React from "react";
55
import { useDispatch, useSelector } from "react-redux";
66

77
import MetadataDetails, { ValueCountItem } from "./MetadataDetails";
8-
import { PrimaryButton, SecondaryButton } from "../Buttons";
8+
import { PrimaryButton, SecondaryButton, TransparentIconButton } from "../Buttons";
99
import ComboBox from "../ComboBox";
1010
import LoadingIcon from "../Icons/LoadingIcon";
1111
import Tooltip from "../Tooltip";
@@ -295,9 +295,10 @@ export default function NewAnnotationPathway(props: NewAnnotationProps) {
295295
<Tooltip content={option}>
296296
<p className={styles.selectedOption}>{option}</p>
297297
</Tooltip>
298-
<IconButton
298+
<TransparentIconButton
299299
className={styles.selectedOptionButton}
300-
iconProps={{ iconName: "Cancel" }}
300+
iconName="Cancel"
301+
title={`Remove ${option}`}
301302
onClick={() => removeDropdownChip(option)}
302303
/>
303304
</div>

packages/core/components/QueryPart/QueryPartRow.module.css

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
.icon-button, .icon-button:hover {
2-
background-color: unset;
3-
color: unset;
42
font-weight: 600;
53
height: 37px;
64
max-width: 22px;
75
width: 100%;
86
}
97

10-
.icon-button:hover {
11-
background-color: unset;
12-
color: var(--highlight-text-color);
13-
}
14-
158
.icon-button i {
169
font-size: 14px;
1710
font-weight: 600;

packages/core/components/QueryPart/QueryPartRow.tsx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { DirectionalHint, Icon, IconButton } from "@fluentui/react";
1+
import { DirectionalHint, Icon } from "@fluentui/react";
22
import classNames from "classnames";
33
import * as React from "react";
44

5-
import { useButtonMenu } from "../Buttons";
5+
import { TransparentIconButton, useButtonMenu } from "../Buttons";
66
import { DnDItem, DnDItemRendererParams } from "../DnDList/DnDList";
77
import Tooltip from "../Tooltip";
88

@@ -58,25 +58,20 @@ export default function QueryGroupRow(props: Props) {
5858
</Tooltip>
5959
</div>
6060
{!!props.item.onRenderEditMenuList && (
61-
<Tooltip content="Edit">
62-
<IconButton
63-
ariaLabel="Edit"
64-
className={classNames(styles.iconButton, styles.hiddenInnerIcon)}
65-
iconProps={{ iconName: "Edit" }}
66-
menuProps={editMenu}
67-
/>
68-
</Tooltip>
61+
<TransparentIconButton
62+
className={classNames(styles.iconButton, styles.hiddenInnerIcon)}
63+
iconName="Edit"
64+
menuProps={editMenu}
65+
title="Edit"
66+
/>
6967
)}
7068
{props.item.onDelete && (
71-
<Tooltip content="Delete">
72-
<IconButton
73-
ariaDescription="Delete"
74-
ariaLabel="Delete"
75-
className={styles.iconButton}
76-
iconProps={{ iconName: "Cancel" }}
77-
onClick={() => props.item.onDelete?.(props.item.id)}
78-
/>
79-
</Tooltip>
69+
<TransparentIconButton
70+
className={styles.iconButton}
71+
iconName="Cancel"
72+
onClick={() => props.item.onDelete?.(props.item.id)}
73+
title="Delete"
74+
/>
8075
)}
8176
</div>
8277
);

packages/core/components/QuerySidebar/Query.module.css

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,6 @@
33
background-color: var(--primary-sidebar-color);
44
}
55

6-
.collapse-button:hover {
7-
color: var(--highlight-text-color);
8-
background-color: var(--highlight-background-color);
9-
}
10-
11-
.expand-button {
12-
color: var(--primary-sidebar-text-color);
13-
background: none;
14-
}
15-
16-
.expand-button:hover {
17-
color: var(--highlight-text-color);
18-
background: none;
19-
}
20-
216
.collapse-button i, .expand-button i {
227
font-weight: 600;
238
}

packages/core/components/QuerySidebar/Query.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { IContextualMenuItem, IconButton, SpinnerSize, TextField } from "@fluentui/react";
1+
import { IContextualMenuItem, SpinnerSize, TextField } from "@fluentui/react";
22
import classNames from "classnames";
33
import * as React from "react";
44
import { useDispatch, useSelector } from "react-redux";
55

66
import QueryFooter from "./QueryFooter";
7+
import { TertiaryButton, TransparentIconButton } from "../Buttons";
78
import LoadingIcon from "../Icons/LoadingIcon";
89
import QueryDataSource from "../QueryPart/QueryDataSource";
910
import QueryFilter from "../QueryPart/QueryFilter";
@@ -119,12 +120,10 @@ export default function Query(props: QueryProps) {
119120
<i>Building new query...</i>
120121
</h4>
121122
</Tooltip>
122-
<IconButton
123-
ariaDescription="Expand view details"
124-
ariaLabel="Expand"
123+
<TransparentIconButton
125124
className={styles.expandButton}
126125
disabled
127-
iconProps={{ iconName: "ChevronDownMed" }}
126+
iconName="ChevronDownMed"
128127
/>
129128
</div>
130129
<hr className={styles.divider}></hr>
@@ -154,13 +153,11 @@ export default function Query(props: QueryProps) {
154153
<Tooltip content={props.query.name}>
155154
<h4>{props.query.name}</h4>
156155
</Tooltip>
157-
<IconButton
158-
ariaDescription="Expand view details"
159-
ariaLabel="Expand"
156+
<TransparentIconButton
160157
className={styles.expandButton}
161158
onClick={() => setIsExpanded(!isExpanded)}
162-
iconProps={{ iconName: "ChevronDownMed" }}
163-
data-testid="expand-button"
159+
iconName="ChevronDownMed"
160+
id="expand-button"
164161
/>
165162
</div>
166163
{!isExpanded && <hr className={styles.divider}></hr>}
@@ -214,13 +211,12 @@ export default function Query(props: QueryProps) {
214211
}
215212
/>
216213
</div>
217-
<IconButton
218-
ariaDescription="Collapse view details"
219-
ariaLabel="Collapse"
214+
<TertiaryButton
220215
className={styles.collapseButton}
221216
onClick={() => setIsExpanded(!isExpanded)}
222-
iconProps={{ iconName: "ChevronUpMed" }}
217+
iconName="ChevronUpMed"
223218
data-testid="collapse-button"
219+
title="Collapse query details"
224220
/>
225221
</div>
226222
<QueryDataSource

0 commit comments

Comments
 (0)