yii2-bootstrap4 icon indicating copy to clipboard operation
yii2-bootstrap4 copied to clipboard

A more user friendly implementation

Open machour opened this issue 6 years ago • 2 comments
trafficstars

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.

machour avatar Jan 16 '19 16:01 machour

Sounds good to me.

samdark avatar Jan 16 '19 16:01 samdark

See if we can make #120 easier too

machour avatar Mar 19 '19 11:03 machour