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

Orders, 2nd iteration #89

Merged
merged 23 commits into from
May 21, 2018
Merged

Orders, 2nd iteration #89

merged 23 commits into from
May 21, 2018

Conversation

maestrow
Copy link
Member

No description provided.

never
> {
protected handleChange = (params: ITogglerChangeParams) => {
this.props.onChange &&
Copy link
Contributor

@serjout serjout May 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's create universal "change api" for all input component.

IChangable<TValue> {
    props: {
        value: TValue;
        name: string;
        onChange(params: IChangeParams<TValue>) => void;
    }
}

interface IChangeParams<TValue> {
    name: string;
    value: TValue;
    stringValue?: string;
}

cssClasses={cssClasses}
onChange={this.handleChange}
type="radio"
name={groupName || ''}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all radiobuttons will have one group by default. it can be confused.

};

public render() {
const cssClasses = this.props.cssClasses
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best way to define default props values is using defaultProps static field.

titleBefore?: boolean;
}

const defaultCssClasses: ICssClasses = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be static part of RadioButton class


const state = observable({
value: 'normal',
onChange: action.bound(function (value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see comment about universal api for input components

className?: string;
elementClassName?: string;
name?: string;
elementCtor: new () => TElement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commonly render not constructor. We should pass here ReactNode.

<Tag
className="elementClassName"
title={this.getDisplayValue(x)}
groupName={this.buttonGroupName}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats will happen if i pass smth without this(groupName) props ?
maybe it needs interface definition for render (elementCtor)

kind of
IToggleGroupProps<TValue, TElement implements IRadioButton>

@@ -18,6 +18,7 @@ export interface ITogglerProps {
className?: string;
cssClasses?: ICssClasses;
onChange?: (params: ITogglerChangeParams) => void;
type?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use evident type def for this props:
type?: 'checkbox' | 'chotuteshemozhetbit' | 'smth'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'checkbox' | 'radiobutton' i think

@@ -48,7 +50,7 @@ export class Toggler extends React.PureComponent<ITogglerProps, never> {
<input
key="a"
name={name}
type="checkbox"
type={type || 'checkbox'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how will it look if i pass "password" here ? ))))

@@ -48,7 +50,7 @@ export class Toggler extends React.PureComponent<ITogglerProps, never> {
<input
key="a"
name={name}
type="checkbox"
type={type || 'checkbox'}
className={cssClasses.input}
checked={value}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here i use 'value' as external interface. please refer to comment about using checked and value together.

@serjout serjout merged commit 7fabb47 into sonm-io:GUI-01-prepare-your-a May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants