Web: Components: Fix problem with click om icon, added size style.

This commit is contained in:
TatianaLopaeva 2021-02-20 18:37:32 +03:00
parent 5fdb5c8508
commit 5949865a45
2 changed files with 19 additions and 14 deletions

View File

@ -138,7 +138,7 @@ class IconButton extends React.PureComponent {
style, style,
dataTip, dataTip,
} = this.props; } = this.props;
console.log("input-block");
return ( return (
<StyledOuter <StyledOuter
className={className} className={className}
@ -154,6 +154,7 @@ class IconButton extends React.PureComponent {
data-event="click focus" data-event="click focus"
data-for={id} data-for={id}
style={style} style={style}
color={this.state.currentIconColor}
//{...this.props} //{...this.props}
> >
{/* {React.createElement(Icons["CalendarIcon"], { {/* {React.createElement(Icons["CalendarIcon"], {
@ -163,13 +164,8 @@ class IconButton extends React.PureComponent {
})} */} })} */}
<ReactSVG <ReactSVG
className="icon-button_svg"
src={this.state.currentIconName} src={this.state.currentIconName}
beforeInjection={(svg) => {
//const [firstGElement] = [...svg.querySelectorAll("path")];
svg
.querySelector("path")
.setAttribute("fill", this.state.currentIconColor);
}}
/> />
</StyledOuter> </StyledOuter>
); );

View File

@ -1,12 +1,21 @@
import styled from "styled-components"; import styled from "styled-components";
const StyledOuter = styled.div` const StyledOuter = styled.div`
width: ${(props) => width: ${(props) =>
props.size ? Math.abs(parseInt(props.size)) + "px" : "20px"}; props.size ? Math.abs(parseInt(props.size)) + "px" : "20px"};
cursor: ${(props) => cursor: ${(props) =>
props.isDisabled || !props.isClickable ? "default" : "pointer"}; props.isDisabled || !props.isClickable ? "default" : "pointer"};
line-height: 0; line-height: 0;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
svg {
&:not(:root) {
width: 100%;
height: 100%;
}
path {
fill: ${(props) => props.color};
}
}
`; `;
export default StyledOuter; export default StyledOuter;