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

[WIP] add span to backpack button text #5343

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

pxpm
Copy link
Contributor

@pxpm pxpm commented Oct 11, 2023

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.

Comment on lines 2 to 4
<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>
Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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>
Copy link
Member

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:

Suggested change
<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>

Copy link
Member

Choose a reason for hiding this comment

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

sma-sexiest-man-alive-gif-by-maytag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

2 participants