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

Notifications Icon Circles #7830

Merged
merged 7 commits into from
Mar 11, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
module: {
rules: [
{
test: /\.(woff(2)?|ttf|eot|svg|otf)(\?v=\d+\.\d+\.\d+)?$/,
test: /\.(woff(2)?|ttf|eot|otf)(\?v=\d+\.\d+\.\d+)?$/,
loaders: [{
loader: 'file-loader',
options: {
Expand All @@ -27,6 +27,17 @@ module.exports = {
},
],
},
{
test: /\.svg$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
}
],
},
],
},
resolve: {
Expand Down
3 changes: 3 additions & 0 deletions app/images/icons/blue-circle-info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/images/icons/green-circle-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/images/icons/red-triangle-exclaim.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/images/icons/yellow-bell.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions ui/app/components/app/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,7 @@
@import 'connected-sites-list/index';

@import '../ui/icon-with-fallback/index';

@import '../ui/circle-icon/index';

@import '../ui/alert-circle-icon/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import CircleIcon from '../circle-icon'

import danger from '../../../../../app/images/icons/red-triangle-exclaim.svg'
import warning from '../../../../../app/images/icons/yellow-bell.svg'

const typeConfig = {
danger: {
circleClass: 'alert-circle-icon--danger',
iconSource: danger,
},
warning: {
circleClass: 'alert-circle-icon--warning',
iconSource: warning,
},
}

export default class AlertCircleIcon extends Component {
static propTypes = {
type: PropTypes.oneOf(Object.keys(typeConfig)).isRequired,
}

render () {
return (
<CircleIcon { ...typeConfig[this.props.type] } />
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import AlertCircleIcon from './alert-circle-icon.component'

export default {
title: 'AlertCircleIcon',
}

export const dangerCircleIcon = () => (
<AlertCircleIcon
type="danger"
/>
)

export const warningCircleIcon = () => (
<AlertCircleIcon
type="warning"
/>
)
1 change: 1 addition & 0 deletions ui/app/components/ui/alert-circle-icon/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './alert-circle-icon.component'
13 changes: 13 additions & 0 deletions ui/app/components/ui/alert-circle-icon/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.alert-circle-icon {
&--danger {
border-color: $danger-red;
color: $danger-red;
background: $danger-light-red;
}

&--warning {
border-color: $warning-yellow;
color: $warning-yellow;
background: $warning-light-yellow;
}
}
52 changes: 52 additions & 0 deletions ui/app/components/ui/circle-icon/circle-icon.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'

export default class CircleIcon extends PureComponent {
static propTypes = {
size: PropTypes.string,
circleClass: PropTypes.string,
iconSource: PropTypes.string.isRequired,
iconSize: PropTypes.string,
}

static defaultProps = {
size: '56px',
iconSize: '18px',
circleClass: '',
}

render () {
const {
size,
circleClass,
iconSize,
iconSource,
} = this.props

return (
<div
className="circle-icon__container"
style={{
height: size,
width: size,
}}
>
<div
className={`circle-icon__border circle-icon__circle ${circleClass}`}
style={{
height: size,
width: size,
}}
/>
<img
src={iconSource}
className="circle-icon__icon"
style={{
height: iconSize,
width: iconSize,
}}
/>
</div>
)
}
}
17 changes: 17 additions & 0 deletions ui/app/components/ui/circle-icon/circle-icon.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'
import CircleIcon from './circle-icon.component'
import img from '../../../../../app/images/eth_logo.svg'

export default {
title: 'CircleIcon',
}

export const basicCircleIcon = () => (
<CircleIcon
border="1px solid"
borderColor="black"
background="white"
iconSize="42px"
iconSource={img}
/>
)
1 change: 1 addition & 0 deletions ui/app/components/ui/circle-icon/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './circle-icon.component'
23 changes: 23 additions & 0 deletions ui/app/components/ui/circle-icon/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.circle-icon {
&__container {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}

&__border {
border-radius: 50%;
position: absolute;
}

&__circle {
border: 1px solid;
border-color: $black;
background: $white;
}

&__icon {
position: relative;
}
}
12 changes: 12 additions & 0 deletions ui/app/css/itcss/settings/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ $blizzard-blue: #bfdef3;
$mischka: #dddee9;
$web-orange: #f2a202;

/*
notification and error message colors
*/
$success-green: #28A745;
$success-light-green: #E8F9F1;
$danger-red: #D73A49;
$danger-light-red: #F8EAE8;
$info-blue: #037DD6;
$info-light-blue: #E8F4FD;
$warning-yellow: #FFD33D;
$warning-light-yellow: #FEFAE8;

/*
Z-Indicies
*/
Expand Down