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

Style Icon Button Hover State #1940

Merged
merged 4 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions ui/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,16 @@ const Button = styled(UnstyledButton)`
}
`;

export const IconButton = styled(UnstyledButton)`
&.MuiButton-root {
border-radius: 50%;
min-width: 48px;
height: 48px;
padding: 0;
}
&.MuiButton-text {
padding: 0;
}
`;

export default Button;
1 change: 1 addition & 0 deletions ui/components/ChipGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ export default styled(ChipGroup).attrs({ className: ChipGroup.name })`
.MuiChip-root {
margin-right: ${(props) => props.theme.spacing.xxs};
}
margin: 4px 0px;
`;
27 changes: 0 additions & 27 deletions ui/components/FilterDialogButton.tsx

This file was deleted.

15 changes: 10 additions & 5 deletions ui/components/FilterableTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from "lodash";
import * as React from "react";
import styled from "styled-components";
import { IconButton } from "./Button";
import ChipGroup from "./ChipGroup";
import DataTable, { Field } from "./DataTable";
import FilterDialog, {
Expand All @@ -9,8 +10,8 @@ import FilterDialog, {
formStateToFilters,
initialFormState,
} from "./FilterDialog";
import FilterDialogButton from "./FilterDialogButton";
import Flex from "./Flex";
import Icon, { IconType } from "./Icon";
import { computeReady } from "./KubeStatusIndicator";
import SearchField from "./SearchField";
import Spacer from "./Spacer";
Expand Down Expand Up @@ -195,18 +196,22 @@ function FilterableTable({

return (
<Flex className={className} wide tall column>
<Flex wide>
<Flex wide align>
<ChipGroup
chips={chips}
onChipRemove={handleChipRemove}
onClearAll={handleClearAll}
/>
<Flex align wide end>
<SearchField onSubmit={handleTextSearchSubmit} />
<FilterDialogButton
dialogOpen={filterDialogOpen}
<IconButton
onClick={() => setFilterDialogOpen(!filterDialogOpen)}
/>
className={className}
variant={filterDialogOpen ? "contained" : "text"}
color="inherit"
>
<Icon type={IconType.FilterIcon} size="medium" color="neutral30" />
</IconButton>
<Spacer padding="xs" />
</Flex>
</Flex>
Expand Down
8 changes: 4 additions & 4 deletions ui/components/SearchField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import styled from "styled-components";
import { Button } from "..";
import { IconButton } from "./Button";
import Flex from "./Flex";
import Icon, { IconType } from "./Icon";
import Input from "./Input";
Expand All @@ -15,7 +15,7 @@ const Expander = styled(({ expanded, className, children }) => (
))`
width: 0px;
transition: width 0.3s ease-in-out;

margin-left: 4px;
&.expanded {
width: 200px;
}
Expand Down Expand Up @@ -46,7 +46,7 @@ function SearchField({ className, onSubmit }: Props) {

return (
<Flex align className={className}>
<Button
<IconButton
onClick={handleExpand}
className={className}
variant="text"
Expand All @@ -57,7 +57,7 @@ function SearchField({ className, onSubmit }: Props) {
size="medium"
color={expanded ? "primary" : "neutral30"}
/>
</Button>
</IconButton>
<Expander expanded={expanded}>
<form onSubmit={handleSubmit}>
<Input
Expand Down
3 changes: 0 additions & 3 deletions ui/components/SourcesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,4 @@ export default styled(SourcesTable).attrs({ className: SourcesTable.name })`
table {
table-layout: fixed;
}
${FilterableTable} {
margin-top: ${(props) => props.theme.spacing.small};
}
`;
6 changes: 1 addition & 5 deletions ui/pages/v2/Automations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@ function Automations({ className }: Props) {

export default styled(Automations).attrs({
className: Automations.name,
})`
${AutomationsTable} {
margin-top: ${(props) => props.theme.spacing.small};
}
`;
})``;