This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(search): 💄 add alternative search show method with icon
- Loading branch information
Showing
8 changed files
with
108 additions
and
53 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import styled from '@emotion/styled'; | ||
|
||
const ButtonIconWrapper = styled('div')` | ||
display: flex; | ||
justify-content: flex-end; | ||
margin: 0 5px; | ||
padding: 6px; | ||
background-color: ${(props) => props.background}; | ||
border-radius: 50%; | ||
cursor: pointer; | ||
&:hover { | ||
svg { | ||
fill: ${(props) => props.hover}; | ||
stroke: ${(props) => props.hover}; | ||
} | ||
} | ||
svg { | ||
transition: ${(props) => props.theme.transitions.hover}; | ||
fill: ${(props) => props.fill}; | ||
stroke: ${(props) => props.stroke}; | ||
} | ||
`; | ||
|
||
const ButtonIcon = ({ icon, ...props }) => { | ||
return ( | ||
<ButtonIconWrapper {...props} role={'button'} tabIndex={0}> | ||
{/* not defining color as a workaround to use css styling instead */} | ||
{icon.render({ color: '' })} | ||
</ButtonIconWrapper> | ||
); | ||
}; | ||
|
||
ButtonIcon.propTypes = { | ||
background: PropTypes.string.isRequired, | ||
hover: PropTypes.string.isRequired, | ||
fill: PropTypes.string.isRequired, | ||
stroke: PropTypes.string.isRequired, | ||
icon: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default ButtonIcon; |
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 @@ | ||
export { default as ButtonIcon } from './ButtonIcon'; |
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
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