Skip to content

Commit

Permalink
Merge pull request #110 from HelixDesignSystem/fixes01
Browse files Browse the repository at this point in the history
Choice Tile Updates
  • Loading branch information
nicko-winner authored Sep 2, 2020
2 parents 2d1fd71 + 0a86b26 commit a4e51d1
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/Checkbox/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React, { useRef, useEffect } from 'react';

const Checkbox = ({ id, label, indeterminate, className, ...rest }) => {
const Checkbox = ({ id, label, indeterminate, className, style, ...rest }) => {
const inputRef = useRef();
useEffect(() => {
inputRef.current.indeterminate = indeterminate;
Expand All @@ -20,6 +20,7 @@ const Checkbox = ({ id, label, indeterminate, className, ...rest }) => {

Checkbox.propTypes = {
className: PropTypes.string,
style: PropTypes.object,
checked: PropTypes.bool,
id: PropTypes.string.isRequired,
disabled: PropTypes.bool,
Expand Down
7 changes: 5 additions & 2 deletions src/ChoiceTile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ const ChoiceTile = ({
size,
subdued,
title,
style,
...rest
}) => {
return (
<label className={classNames({ hxChoice: true, className })}>
<label className={classNames({ hxChoice: true }, className)} style={style}>
<input
checked={wcBool(checked)}
disabled={disabled}
invalid={invalid?.toString()}
name={name}
onChange={onChange}
type="radio"
{...rest}
/>
<hx-tile class={classNames({ hxSubdued: subdued, [SIZES[size]]: true })} {...rest}>
<hx-tile class={classNames({ hxSubdued: subdued, [SIZES[size]]: true })}>
<hx-icon type="checkmark"></hx-icon>
{icon && (
<div className="hx-tile-icon">
Expand All @@ -47,6 +49,7 @@ ChoiceTile.propTypes = {
checked: PropTypes.bool.isRequired,
children: PropTypes.node,
className: PropTypes.string,
style: PropTypes.object,
disabled: PropTypes.bool,
icon: PropTypes.string,
invalid: PropTypes.bool,
Expand Down
4 changes: 2 additions & 2 deletions src/ChoiceTile/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ storiesOf('Choice Tile', module).add('All Knobs', () => {
icon={icon}
name="choiceTileDemo"
onChange={action('onChange')}
style={{ width: 200 }}
style={{ width: 200, float: 'left' }}
title={title || defaultTitle}
>
{<p>{description || defaultDescription}</p>}
Expand All @@ -55,7 +55,7 @@ storiesOf('Choice Tile', module).add('All Knobs', () => {
<ChoiceTile
icon="bell"
name="choiceTileDemo"
style={{ marginLeft: 25, width: 200 }}
style={{ marginLeft: 25, width: 200, float: 'left' }}
title="Other Choice"
>
{<p>{defaultDescription}</p>}
Expand Down
5 changes: 3 additions & 2 deletions src/Radio/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';

const Radio = ({ id, label, className, ...rest }) => {
const Radio = ({ id, label, className, style, ...rest }) => {
return (
<hx-radio-control class={className}>
<hx-radio-control class={className} style={style}>
<input {...rest} id={id} type="radio" />
<label htmlFor={id}>
<hx-radio></hx-radio>
Expand All @@ -16,6 +16,7 @@ const Radio = ({ id, label, className, ...rest }) => {
Radio.propTypes = {
label: PropTypes.string.isRequired,
className: PropTypes.string,
style: PropTypes.object,
checked: PropTypes.bool,
id: PropTypes.string.isRequired,
disabled: PropTypes.bool,
Expand Down
4 changes: 3 additions & 1 deletion src/Search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const Search = ({
required,
containerId,
value,
style,
...rest
}) => {
/**
Expand All @@ -39,7 +40,7 @@ const Search = ({
}, [value]);

return (
<hx-search-control class={className} id={containerId}>
<hx-search-control class={className} id={containerId} style={style}>
<input
id={id}
value={value}
Expand Down Expand Up @@ -69,6 +70,7 @@ const Search = ({

Search.propTypes = {
className: PropTypes.string,
style: PropTypes.object,
clearLabel: PropTypes.string,
label: PropTypes.string,
id: PropTypes.string.isRequired,
Expand Down
4 changes: 3 additions & 1 deletion src/Select/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ const Select = ({
onChange,
optional,
required,
style,
...rest
}) => {
return (
<hx-select-control class={className}>
<hx-select-control class={className} style={style}>
<select id={id} disabled={disabled} onChange={onChange} required={required} {...rest}>
{children}
</select>
Expand All @@ -37,6 +38,7 @@ const Select = ({
Select.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
style: PropTypes.object,
disabled: PropTypes.bool,
id: PropTypes.string.isRequired,
label: PropTypes.string,
Expand Down
16 changes: 14 additions & 2 deletions src/Text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ import PropTypes from 'prop-types';
import React from 'react';
import classnames from 'classnames';

const Text = ({ id, label, className, required, optional, children, prefix, suffix, ...rest }) => {
const Text = ({
id,
label,
className,
required,
optional,
children,
prefix,
suffix,
style,
...rest
}) => {
return (
<hx-text-control class={className}>
<hx-text-control class={className} style={style}>
<input {...rest} id={id} required={required} type="text" />
<label
className={classnames({
Expand All @@ -26,6 +37,7 @@ const Text = ({ id, label, className, required, optional, children, prefix, suff
Text.propTypes = {
id: PropTypes.string.isRequired,
className: PropTypes.string,
style: PropTypes.object,
children: PropTypes.node,
optional: PropTypes.bool,
disabled: PropTypes.bool,
Expand Down
5 changes: 3 additions & 2 deletions src/TextArea/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import PropTypes from 'prop-types';
import React from 'react';
import classnames from 'classnames';

const TextArea = ({ id, label, className, required, optional, children, ...rest }) => {
const TextArea = ({ id, label, className, required, optional, children, style, ...rest }) => {
return (
<hx-textarea-control class={className}>
<hx-textarea-control class={className} style={style}>
<textarea {...rest} id={id} required={required} />
<label
className={classnames({
Expand All @@ -23,6 +23,7 @@ const TextArea = ({ id, label, className, required, optional, children, ...rest
TextArea.propTypes = {
id: PropTypes.string.isRequired,
className: PropTypes.string,
style: PropTypes.object,
children: PropTypes.node,
optional: PropTypes.bool,
disabled: PropTypes.bool,
Expand Down

0 comments on commit a4e51d1

Please sign in to comment.