Skip to content
Snippets Groups Projects
Commit 4beac9ed authored by Loïc Correnson's avatar Loïc Correnson Committed by David Bühler
Browse files

[dome] icon & icon-button visibility & display

parent eeee3df0
No related branches found
No related tags found
Loading
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
import _ from 'lodash'; import _ from 'lodash';
import React from 'react'; import React from 'react';
import { classes } from 'dome/misc/utils'; import { classes, styles } from 'dome/misc/utils';
import Gallery from './gallery.json'; import Gallery from './gallery.json';
import './style.css'; import './style.css';
...@@ -84,7 +84,7 @@ export function SVG(props: SVGprops): null | JSX.Element { ...@@ -84,7 +84,7 @@ export function SVG(props: SVGprops): null | JSX.Element {
width={size} width={size}
style={{ bottom: offset }} style={{ bottom: offset }}
viewBox={viewBox} viewBox={viewBox}
className = {className} className={className}
> >
{title && <title>{title}</title>} {title && <title>{title}</title>}
<path d={path} fill={fill} /> <path d={path} fill={fill} />
...@@ -100,6 +100,10 @@ export function SVG(props: SVGprops): null | JSX.Element { ...@@ -100,6 +100,10 @@ export function SVG(props: SVGprops): null | JSX.Element {
export interface IconProps extends SVGprops { export interface IconProps extends SVGprops {
/** Additional class name(s). */ /** Additional class name(s). */
className?: string; className?: string;
/** Display (default is true). */
display?: boolean;
/** Visibility (default is true). */
visible?: boolean;
/** Additional DIV style. */ /** Additional DIV style. */
style?: React.CSSProperties; style?: React.CSSProperties;
/** Fill style property. */ /** Fill style property. */
...@@ -115,10 +119,16 @@ export interface IconProps extends SVGprops { ...@@ -115,10 +119,16 @@ export interface IconProps extends SVGprops {
export function Icon(props: IconProps): JSX.Element { export function Icon(props: IconProps): JSX.Element {
const { const {
id, title, onClick, fill, id, title, onClick, fill,
size, className = '', offset, style, size, className, offset, style,
visible = true, display = true,
} = props; } = props;
const divClass = classes('dome-xIcon', className); const divClass = classes(
const divStyle = fill ? { fill, ...style } : style; 'dome-xIcon',
!visible && 'dome-control-hidden',
!display && 'dome-control-erased',
className
);
const divStyle = styles(fill && { fill }, style);
return ( return (
<div <div
className={divClass} className={divClass}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment