Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

[Field] Adding the possibility to show or hide the label #125

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

GuenoleK
Copy link
Contributor

@GuenoleK GuenoleK commented Nov 3, 2016

[Field] Adding the possibility to show or hide the label

Description

Adding the possibility to display or hide a field's label by giving a prop hasLabel which is a boolean type.
It is, by default, set to true.

Fixes #114

@GuenoleK GuenoleK added this to the 3.0.0 milestone Nov 3, 2016

if(typeof hasLabel != 'boolean') {
throw new Error('The given props hasLabel should be a boolean');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

PropsType is good for that no ?

<div data-focus='field-value-container' className='mdl-cell mdl-cell--top mdl-cell--8-col'>{ValueComponent}</div>
</div>
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You will be in conflict with Thomas with that

@GuenoleK
Copy link
Contributor Author

GuenoleK commented Nov 3, 2016

@Ephrame are you ok with this ?

@GuenoleK
Copy link
Contributor Author

GuenoleK commented Nov 3, 2016

@Ephrame @TomGallon I'm was thinking with @TomGallon about a solution and we a agree with this :

isRaw and displayLabel (props)

Considering the issue, we have think about a solution even for the futur

img_20161103_200207

A fieldFor should have :

  • a displayLabel (boolean which should treat (in term of design) but hide the label for a field. This would let the space which was the label's place if it's set to false.
    list
  • a isRaw prop which could give the possibility to display the component as it is given, without design treatment.

Problem : how raw do we want it ?

Still meditating with you, I'm asking this question : how raw do we want it ?

I've tested some cases

  • case 1 :
    listraw
  • case 2 :

listraw2

  • case 3 :
    listraw3

@GuenoleK
Copy link
Contributor Author

GuenoleK commented Nov 7, 2016

So I've updated the field component for the case it's a list.

sans titre

What we have now

We can now give 2 new props on the field's options when it's declared :

  • displayLabel which keeps the normal display but without the label/title by keeping the default space

listdisplaylabel

  • isRaw which only keep the raw list component but displays it as it's given

listisraw

What was already ther

There was a prop called textOnly. It's still there. It displays the raw component and delete the label's space.

listtextonly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants