Created generalised icon button component

This commit is contained in:
Vincent 2019-12-05 16:02:32 +11:00
parent 24e24681a6
commit a6fb54233a
15 changed files with 173 additions and 1 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="0 0 640 640" width="640" height="640"><defs><path d="M442.27 0L122.27 320L442.27 640L517.73 564.53L273.2 320L517.73 75.47L442.27 0Z" id="cuPeB5UrI"></path></defs><g><g><g><use xlink:href="#cuPeB5UrI" opacity="1" fill="#ffffff" fill-opacity="1"></use><g><use xlink:href="#cuPeB5UrI" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 688 B

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="0 0 640 640" width="640" height="640"><defs><path d="M628.27 68.33C643.91 52.71 643.91 27.36 628.27 11.74C612.64 -3.9 587.31 -3.9 571.68 11.74C554.9 28.52 471.01 112.41 320.01 263.41C169 112.41 85.1 28.52 68.32 11.74C52.69 -3.9 27.36 -3.9 11.73 11.74C-3.91 27.36 -3.91 52.71 11.73 68.33C28.51 85.11 112.4 169 263.41 320.01C112.4 471.01 28.51 554.9 11.73 571.68C-3.91 587.3 -3.91 612.65 11.73 628.27C19.55 636.08 29.79 639.99 40.02 639.99C50.26 639.99 60.5 636.08 68.32 628.26C85.1 611.48 169 527.59 320.01 376.59C471.01 527.59 554.9 611.48 571.68 628.26C579.5 636.08 589.74 639.99 599.98 639.99C610.21 639.99 620.45 636.08 628.27 628.26C643.91 612.64 643.91 587.29 628.27 571.67C611.49 554.89 527.6 471 376.6 320.01C527.6 169 611.49 85.11 628.27 68.33Z" id="a1PlFlmK0C"></path></defs><g><g><g><use xlink:href="#a1PlFlmK0C" opacity="1" fill="#ffffff" fill-opacity="1"></use><g><use xlink:href="#a1PlFlmK0C" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="-1 14.665305563793144 644 612.6693888724137" width="640" height="608.67"><defs><path d="M640 248.16L494.82 408.93L517.77 624.33L320 535.94L122.23 624.33L145.18 408.93L0 248.16L211.96 203.42L320 15.67L428.04 203.42L640 248.16ZM75.93 272.83L186.66 395.45L169.16 559.75L320 492.33L470.84 559.75L453.34 395.45L564.07 272.83L402.41 238.71L320 95.5L237.59 238.71L75.93 272.83Z" id="b34DkQmvT"></path></defs><g><g><use xlink:href="#b34DkQmvT" opacity="1" fill="#ffffff" fill-opacity="1"></use><g><use xlink:href="#b34DkQmvT" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g></g></svg>

After

Width:  |  Height:  |  Size: 920 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="0 0 640 640" width="640" height="640"><defs><path d="M320 240C275.82 240 240 275.82 240 320C240 364.18 275.82 400 320 400C364.18 400 400 364.18 400 320C400 275.82 364.18 240 320 240Z" id="aHLiD5Eyx"></path><path d="M320 480C275.82 480 240 515.82 240 560C240 604.18 275.82 640 320 640C364.18 640 400 604.18 400 560C400 515.82 364.18 480 320 480Z" id="c3xckQkYml"></path><path d="M320 0C275.82 0 240 35.82 240 80C240 124.18 275.82 160 320 160C364.18 160 400 124.18 400 80C400 35.82 364.18 0 320 0Z" id="i1WFOiY6Kf"></path></defs><g><g><g><use xlink:href="#aHLiD5Eyx" opacity="1" fill="#ffffff" fill-opacity="1"></use><g><use xlink:href="#aHLiD5Eyx" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g><g><use xlink:href="#c3xckQkYml" opacity="1" fill="#ffffff" fill-opacity="1"></use><g><use xlink:href="#c3xckQkYml" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g><g><use xlink:href="#i1WFOiY6Kf" opacity="1" fill="#ffffff" fill-opacity="1"></use><g><use xlink:href="#i1WFOiY6Kf" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.4 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 31 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,3 +1,4 @@
/* global i18n, Whisper */
// eslint-disable-next-line func-names

View file

@ -5,6 +5,18 @@ $session-color-black: #000;
$session-font-family: Waza;
$session-transition-duration: 0.25s;
$session-icon-size-sm: 16px;
$session-icon-size-md: 20px;
$session-icon-size-lg: 28px;
.content{
background-color: $session-color-black !important;
}
.session-button {
min-width: 165px;
width: auto;
@ -41,4 +53,55 @@ $session-font-family: Waza;
@include transparent-background($session-color-white);
}
}
.session-icon-button {
fill: $session-color-white;
opacity: 0.4;
cursor: pointer;
display: inline-block;
transition: opacity $session-transition-duration;
&.small {
line-height: $session-icon-size-sm;
height: $session-icon-size-sm;
width: $session-icon-size-sm;
margin: $session-icon-size-sm / 3;
img {
height: $session-icon-size-sm;
width: $session-icon-size-sm;
}
}
&.medium {
line-height: $session-icon-size-md;
height: $session-icon-size-md;
width: $session-icon-size-md;
margin: $session-icon-size-md / 3;
img {
height: $session-icon-size-md;
width: $session-icon-size-md;
}
}
&.large {
line-height: $session-icon-size-lg;
height: $session-icon-size-lg;
width: $session-icon-size-lg;
margin: $session-icon-size-lg / 3;
img {
height: $session-icon-size-lg;
width: $session-icon-size-lg;
}
}
&:hover{
opacity: 1;
}
}

View file

@ -0,0 +1,72 @@
import React from 'react';
import classNames from 'classnames';
export enum SessionIconButtonTypes {
'exit' = 'exit',
'search' = 'search',
'back' = 'back',
'attachment' = 'attachment',
'emoji' = 'emoji',
'favorite' = 'favorite',
'group' = 'group',
'menu' = 'menu',
'message' = 'message',
'microphone' = 'microphone',
'network' = 'network',
'options' = 'options',
'theme' = 'theme',
}
export enum SessionIconButtonSizes {
'small' = 'small',
'medium' = 'medium',
'large' = 'large',
}
interface Props {
iconType: SessionIconButtonTypes;
iconSize: SessionIconButtonSizes;
}
export class SessionIconButton extends React.PureComponent<Props> {
constructor(props: any){
super(props);
this.clickHandler = this.clickHandler.bind(this);
}
public render() {
const {
iconType,
iconSize,
} = this.props;
let iconPath = `./images/session/icon-${iconType}.svg`;
return (
<div
className={classNames(
'session-icon-button',
iconType === SessionIconButtonTypes.exit ? 'exit' : '',
iconType === SessionIconButtonTypes.search ? 'search' : '',
iconType === SessionIconButtonTypes.back ? 'back' : '',
iconSize === SessionIconButtonSizes.small ? 'small' : '',
iconSize === SessionIconButtonSizes.medium ? 'medium' : '',
iconSize === SessionIconButtonSizes.large ? 'large' : ''
)}
role='button'
onClick={this.clickHandler}
>
<img src={iconPath}/>
</div>
);
}
clickHandler(){
return;
}
}