From 88ba5ecdadbc74a49f8de499d0cef43e778d82a8 Mon Sep 17 00:00:00 2001 From: brevis Date: Mon, 10 Dec 2018 02:27:13 +0300 Subject: [PATCH] center icon --- @src/TitleInput/TitleInput.stories.tsx | 66 +++++- @src/TitleInput/TitleInput.tsx | 9 +- @src/TitleInput/style.m.scss | 20 +- package-lock.json | 301 +++++++++++++++++++++++++ package.json | 2 + 5 files changed, 384 insertions(+), 14 deletions(-) diff --git a/@src/TitleInput/TitleInput.stories.tsx b/@src/TitleInput/TitleInput.stories.tsx index f6e2f23..8afddcc 100644 --- a/@src/TitleInput/TitleInput.stories.tsx +++ b/@src/TitleInput/TitleInput.stories.tsx @@ -1,10 +1,12 @@ +import InsertDriveFile from '@material-ui/icons/InsertDriveFile'; import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; import * as React from 'react'; import { FaFile } from 'react-icons/fa'; +import { MdInsertDriveFile } from 'react-icons/md'; +import { TiDocument } from 'react-icons/ti'; import { Field, reduxForm } from 'redux-form'; import { length, required } from 'redux-form-validators'; - import { FormDecorator } from '../../.storybook/decorators'; import { TitleInput } from './index'; @@ -90,4 +92,66 @@ storiesOf('Atoms/TitleInput', module) )} ); + }) + .add('icon', () => { + return ( +
+
+ {React.createElement( + MyForm({ + label: 'No icon', + placeholder: '(empty)' + }) + )} +
+ +
+ +
+ {React.createElement( + MyForm({ + icon: , + label: 'Font Awesome Icons', + placeholder: '(empty)' + }) + )} +
+ +
+ +
+ {React.createElement( + MyForm({ + icon: , + label: 'Material Icons', + placeholder: '(empty)' + }) + )} +
+ +
+ +
+ {React.createElement( + MyForm({ + icon: , + label: 'Typeicons', + placeholder: '(empty)' + }) + )} +
+ +
+ +
+ {React.createElement( + MyForm({ + icon: , + label: 'Material UI Icons', + placeholder: '(empty)' + }) + )} +
+
+ ); }); diff --git a/@src/TitleInput/TitleInput.tsx b/@src/TitleInput/TitleInput.tsx index 0659433..8e132ac 100644 --- a/@src/TitleInput/TitleInput.tsx +++ b/@src/TitleInput/TitleInput.tsx @@ -169,12 +169,15 @@ class TitleInput extends React.Component { )}
- {icon &&
{icon}
} + {icon && ( +
+
{icon}
+
+ )}