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
[WIP] add span to backpack button text #5343
base: main
Are you sure you want to change the base?
Conversation
<a href="{{ url($crud->route.'/create') }}" class="btn btn-primary" data-style="zoom-in"> | ||
<span><i class="la la-plus"></i> {{ trans('backpack::crud.add') }} {{ $crud->entity_name }}</span> | ||
<span><i class="la la-plus"></i> <span class="create-button-text-span">{{ trans('backpack::crud.add') }} {{ $crud->entity_name }}</span></span> | ||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we add bp-button="create"
to the anchor? That way you can style the button itself too, if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it'd be similar to our other CSS hooks, bp-section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,6 +1,6 @@ | |||
@if ($crud->hasAccess('delete')) | |||
<a href="javascript:void(0)" onclick="deleteEntry(this)" data-route="{{ url($crud->route.'/'.$entry->getKey()) }}" class="btn btn-sm btn-link" data-button-type="delete"> | |||
<span><i class="la la-trash"></i> {{ trans('backpack::crud.delete') }}</span> | |||
<span><i class="la la-trash"></i> <span class="delete-button-text-span">{{ trans('backpack::crud.delete') }}</span></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need two spans? One for the entire button content, one for the text? Cause if we only need one for the text, it should be as easy as moving the span start after the icon. No class needed:
<span><i class="la la-trash"></i> <span class="delete-button-text-span">{{ trans('backpack::crud.delete') }}</span></span> | |
<i class="la la-trash"></i> <span>{{ trans('backpack::crud.delete') }}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported in #5010
we could make developers life easier when they want to hide the button text and display only an icon by wrapping the button text in a span as suggested by @tabacitu
I've decided to create a class for each button type, eg:
create-button-text-span
,update-button-text-span
. That way developers have the ability to hide only specific button texts, or hide all of them with*-button-text-span
selector.