yiisoft / yii2-bootstrap4

Yii 2 Bootstrap 4 Extension
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
216 stars 106 forks source link

A more user friendly implementation #98

Open machour opened 5 years ago

machour commented 5 years ago

Something that was already bugging me with yii2-bootstrap, and is now even "worse", is the developer experience when using the Yii2 bootstrap packages.

Take for instance the Progress component.

Even with bootstrap3, creating a successful animating stripped progress at 70% is painful:

// striped animated
echo Progress::widget([
   'percent' => 70,
   'barOptions' => ['class' => 'progress-bar-success'],
   'options' => ['class' => 'active progress-striped']
]);

Here, I need to remember the class names and what class should go on what part of the Progress element, etc.

You end up most of the time consulting the bootstrap documentation to remember the syntax, and there, you just have the plain HTML snippet sitting in front of you, that you could copy/paste and be done with.

I think that we need to care more about DX here, and that creating a progress element should be as straight forward as:

Progress::widget(['percent' => 20, 'color' => Bootstrap::SUCCESS, 'striped' => true, 'animated' => true]);

options would be kept for a more advanced usage, when the developer really wants to stray out of bootstrap path.

samdark commented 5 years ago

Sounds good to me.

machour commented 5 years ago

See if we can make #120 easier too