-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Unify styling of widget action icons #8064
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
df96ef2
Unify widget action buttons styling
linuspahl 56c2298
Update snapshot
linuspahl 9f2a3ac
Remove not needed link role
linuspahl 40f1a54
Disable eslint warning for IconButton and PageErrorOverview dependecy…
linuspahl 2c1e63c
Import common components directly in PageErrorOverview and IconButton…
linuspahl 2a78fce
Remove background color of IconButtons for Firefox
linuspahl f502e16
Update snapshots
linuspahl 22909d9
Add missing semicolon in Widget.jsx
linuspahl 65e866c
Updating snapshots
linuspahl File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
graylog2-web-interface/src/components/common/IconButton.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// @flow strict | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled, { type StyledComponent } from 'styled-components'; | ||
|
||
import { type ThemeInterface } from 'theme'; | ||
import Icon from 'components/common/Icon'; | ||
|
||
const Wrapper: StyledComponent<{}, ThemeInterface, HTMLButtonElement> = styled.button(({ theme }) => ` | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
height: 25px; | ||
width: 25px; | ||
border: 0 | ||
|
||
background-color: transparent; | ||
cursor: pointer; | ||
color: ${theme.color.gray[70]}; | ||
font-size: 16px; | ||
|
||
:hover { | ||
background-color: ${theme.color.gray[90]}; | ||
} | ||
|
||
:active { | ||
background-color: ${theme.color.gray[80]}; | ||
} | ||
`); | ||
|
||
|
||
type Props = { | ||
title: string, | ||
onClick?: () => void, | ||
}; | ||
|
||
const handleClick = (onClick) => { | ||
if (typeof onClick === 'function') { | ||
onClick(); | ||
} | ||
}; | ||
|
||
const IconButton = ({ title, onClick, ...rest }: Props) => ( | ||
<Wrapper title={title} onClick={() => handleClick(onClick)}> | ||
<Icon {...rest} /> | ||
</Wrapper> | ||
); | ||
|
||
IconButton.propTypes = { | ||
title: PropTypes.string, | ||
onClick: PropTypes.func, | ||
}; | ||
|
||
IconButton.defaultProps = { | ||
onClick: undefined, | ||
title: undefined, | ||
}; | ||
|
||
export default IconButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
graylog2-web-interface/src/views/components/widgets/Widget.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
graylog2-web-interface/src/views/components/widgets/WidgetHorizontalStretch.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered requiring the
onClick
prop, but e.g. inReplaySearchButton
we need to wrap the button with a link, because we can't open the page in another tab withhistory.push()