From 87c3090f47f2ee86d7ac6c120307a7d461823e76 Mon Sep 17 00:00:00 2001 From: Matt Shwery Date: Fri, 20 Jul 2018 12:29:43 -0500 Subject: [PATCH] Bug/select icon margin (#237) * add padding for icon on Select, add SelectField, add docs * wip. include in docs * wip --- docs/src/componentRoutes.js | 4 + docs/src/utils/getComponent.js | 3 +- src/select/docs/examples/Select-basic.example | 4 + src/select/docs/index.js | 66 +++++++++ src/select/index.js | 1 + src/select/src/Select.js | 7 +- src/select/src/SelectField.js | 125 ++++++++++++++++++ src/text-input/src/TextInputField.js | 9 +- 8 files changed, 210 insertions(+), 9 deletions(-) create mode 100644 src/select/docs/examples/Select-basic.example create mode 100644 src/select/docs/index.js create mode 100644 src/select/src/SelectField.js diff --git a/docs/src/componentRoutes.js b/docs/src/componentRoutes.js index c846e8fc2..0a30a0a40 100644 --- a/docs/src/componentRoutes.js +++ b/docs/src/componentRoutes.js @@ -48,6 +48,10 @@ module.exports = [ name: 'Colors', path: '/components/colors' }, + { + name: 'Select', + path: '/components/select' + }, { name: 'Select Menu', path: '/components/select-menu' diff --git a/docs/src/utils/getComponent.js b/docs/src/utils/getComponent.js index 273c42a00..57d4938df 100644 --- a/docs/src/utils/getComponent.js +++ b/docs/src/utils/getComponent.js @@ -7,7 +7,6 @@ import buttonsDocs from '../../../src/buttons/docs' import autocompleteDocs from '../../../src/autocomplete/docs/' import comboboxDocs from '../../../src/combobox/docs/' // import badgesDocs from '../../src/badges/docs/' -// import selectDocs from '../../src/select/docs/' import popoverDocs from '../../../src/popover/docs/' // import portalDocs from '../../src/portal/docs/' import textInputDocs from '../../../src/text-input/docs/' @@ -29,6 +28,7 @@ import cornerDialogDocs from '../../../src/corner-dialog/docs/' import alertDocs from '../../../src/alert/docs/' import toasterDocs from '../../../src/toaster/docs/' import selectMenuDocs from '../../../src/select-menu/docs/' +import selectDocs from '../../../src/select/docs/' const map = { radio: radioDocs, @@ -41,6 +41,7 @@ const map = { layers: layersDocs, typography: typographyDocs, colors: colorsDocs, + select: selectDocs, 'select menu': selectMenuDocs, 'text input': textInputDocs, 'search input': searchInputDocs, diff --git a/src/select/docs/examples/Select-basic.example b/src/select/docs/examples/Select-basic.example new file mode 100644 index 000000000..c8bc704ef --- /dev/null +++ b/src/select/docs/examples/Select-basic.example @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/src/select/docs/index.js b/src/select/docs/index.js new file mode 100644 index 000000000..d09e6be85 --- /dev/null +++ b/src/select/docs/index.js @@ -0,0 +1,66 @@ +import React from 'react' +import Box from 'ui-box' +import Component from '@reactions/component' +import Select from '../src/Select' + +/* eslint-disable import/no-unresolved, import/no-webpack-loader-syntax */ +import sourceSelect from '!raw-loader!../src/Select' +/* eslint-enable import/no-unresolved, import/no-webpack-loader-syntax */ + +/** + * Code examples + */ +import exampleSelectBasic from './examples/Select-basic.example' + +const title = 'Select' +const subTitle = 'A styled native + + ) + } +} diff --git a/src/text-input/src/TextInputField.js b/src/text-input/src/TextInputField.js index 12edd23d0..e90e26b70 100644 --- a/src/text-input/src/TextInputField.js +++ b/src/text-input/src/TextInputField.js @@ -64,11 +64,8 @@ export default class TextInputField extends PureComponent { inputHeight: 32 } - constructor(props) { - super(props) - this.state = { - id: (props.id || idCounter++).toString() - } + state = { + id: (this.props.id || idCounter++).toString() } render() { @@ -96,7 +93,7 @@ export default class TextInputField extends PureComponent { ...props } = this.props - const { id } = this.state + const id = `TextInputField-${this.state.id}` /** * Split the wrapper props from the input props.