Git Product home page Git Product logo

Comments (6)

jonathan-bird avatar jonathan-bird commented on June 5, 2024 2
Screenshot 2023-09-15 at 8 39 43 am

Just adding to this, based on Filament's defaults, I think that this possibly suits as the default values and then in the docs might be worth adding the different styles (eg button-only view, larger icon etc.)

Impersonate::make()
    ->link()
    ->iconSize(IconSize::Small)
    ->label('Login as'),

The comparison style is to Filament's pre-built actions in v3 which you may want to stay consistent with:

Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
Tables\Actions\ForceDeleteAction::make(),
Tables\Actions\RestoreAction::make()

from filament-impersonate.

jszobody avatar jszobody commented on June 5, 2024

Hmm. I don't think we set a label for the table action, since it's usually desirable to just show an action with no label when it's inline.

I bet you could do Impersonate::make()->label('Impersonate')->redirectTo('/admin') yourself in the group, can you try that?

Not sure what the best solution here is. I like it being just an icon when inline, but clearly it needs a label in a group like this.

from filament-impersonate.

malle-pietje avatar malle-pietje commented on June 5, 2024

Hmm. I don't think we set a label for the table action, since it's usually desirable to just show an action with no label when it's inline.

I bet you could do Impersonate::make()->label('Impersonate')->redirectTo('/admin') yourself in the group, can you try that?

Not sure what the best solution here is. I like it being just an icon when inline, but clearly it needs a label in a group like this.

Thanks. I had already tried that but that doesn't generate label like the other elements in the group. It's not crucial; if I can find the time I'll see how this can best be achieved.

from filament-impersonate.

malle-pietje avatar malle-pietje commented on June 5, 2024

I changed the code for STS\FilamentImpersonate\Tables\Actions\Impersonate to this:

    protected function setUp(): void
    {
        parent::setUp();

//        $this
//            ->iconButton()
//            ->icon('impersonate-icon')
//            ->action(fn ($record) => $this->impersonate($record))
//            ->hidden(fn ($record) => !$this->canBeImpersonated($record));
        $this->icon('impersonate-icon');
        $this->color('primary');
        $this->action(fn ($record) => $this->impersonate($record));
        $this->hidden(fn ($record) => !$this->canBeImpersonated($record));
    }

And now in my Action group I get this:
image

and on hover:
image

This does look more consistent IMHO.

from filament-impersonate.

malle-pietje avatar malle-pietje commented on June 5, 2024

For now I've implemented a custom Action class that extends STS\FilamentImpersonate\Tables\Actions\Impersonate Filament\Tables\Actions\Action so I'm happy 😉

Thanks for this great plugin!

from filament-impersonate.

trippo avatar trippo commented on June 5, 2024

The actual solution is:

Impersonate::make()->grouped()

from filament-impersonate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.