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

yii\authclient\widgets\AuthChoice displays nothing by default

Open lukos opened this issue 6 years ago • 10 comments

Do: Use this widget to create a list of login links in the way it is displayed in the docs.

Expect: I would expect something that works out of the box and displays either a button or a link with the name of the provider.

Actual: What you get is an invisible link(s) with no text since the widget appears to put a blank string as the content of the span inside the link. The provider name does get added to the class of both the link and the inner span but surely, at least by default, should also be the inner text of the span?

This might be a documentation issue, maybe I should have added other properties to the widget?

What would possibly make more sense is that if there is no custom text set, it adds the name of the provider in the link. It should probably also allow custom "class" so that it can be e.g. a button or a link depending on what the user wants.

Again, happy to PR if I can have some direction on whether it is a docs issue, or whether some improvements could be made?

lukos avatar May 22 '18 10:05 lukos

These links should be CSS-styled.

samdark avatar May 22 '18 11:05 samdark

I will make a PR for the docs, although I don't see how to easily style them with css. It works if I used a.Provider:after { content: "Provider name"; } but that seems a bit weird - why use a span if you can write the text directly into the link? Maybe it only really works properly when used in the custom style. I think we could maybe make this nicer but happy to park after making it clearer in the docs.

lukos avatar May 22 '18 19:05 lukos

I mean they're styled out of the box. Widget should register CSS assets needed.

samdark avatar May 23 '18 22:05 samdark

OK, I'll look. It might be because my site does not use Bootstrap.

lukos avatar May 24 '18 08:05 lukos

It only styles the built-in clients using the icons from authchoice.png If you create a custom client based on e.g. OpenIdConnect, it displays a transparent icon and no text. Please let me know whether you think the instructions should be changed to tell the developer what to do or whether some code needs changing to make clients without the built-in names to display something.

lukos avatar May 24 '18 18:05 lukos

Indeed it won't work for custom clients. Not sure what's the best way to solve it so it could be extended easily. Any idea?

samdark avatar May 24 '18 23:05 samdark

What about extending the icon image to include the letters A-Z as well as Google, Twitter etc. so that a property on the config could be, say, iconLetter => 'P' which will set the correct css class to offset the image. Also, if the user wants their own image, then we could extend the instructions to say where to put the image and what css would be required to do the same thing as the plugin does for Google, Twitter etc.?

lukos avatar May 25 '18 13:05 lukos

Yes, that sounds like a good option.

samdark avatar May 26 '18 20:05 samdark

I feel that adding 26 tiles to our sprite is a bit "too much" for people using only Facebook or Twitter.

Documenting how to use your own images would be better.

machour avatar Mar 26 '19 09:03 machour

Agree.

samdark avatar Mar 26 '19 10:03 samdark