简体   繁体   English

JHipster和社交登录按钮

[英]JHipster and Social login button

I have a project that is written in JHipster v4.9.0 and I am working on a upgrade to v 5.3.0. 我有一个用JHipster v4.9.0编写的项目,我正在努力升级到v 5.3.0。

I really miss the social login feature from earlier versions of JHipster and I need the social login buttons and service back in my project. 我真的很想念早期版本的JHipster的社交登录功能,我需要在项目中重新添加社交登录按钮和服务。

I have installed bootstrap social from https://libraries.io/npm/bootstrap-social with the command: 我已经使用以下命令从https://libraries.io/npm/bootstrap-social安装了bootstrap social:

npm install bootstrap-social@5.1.1

Now I have in my package.json file the line 现在我的package.json文件中有这一行

"bootstrap-social": "5.1.1",

Then I have in my login page 然后我在登录页面中

<a class="btn btn-block btn-social btn-facebook">
  <span class="fa fa-facebook"></span>
  Sign in with Facebook  
</a>

But my problem is that I can not see the facebook logo on my button. 但是我的问题是我在按钮上看不到Facebook徽标。 Is there anything more I have to do to get the logo to show up? 我还需要做些什么才能使徽标显示出来?

The Facebook logo is using Font Awesome, which changed the imports in v5. Facebook徽标使用的是Font Awesome,它更改了v5中的导入。 First, add the following package in your package.json to the specified version (this includes brand icons such as social networks): 首先,在package.json中将以下包添加到指定版本(这包括品牌图标,例如社交网络):

npm install --save @fortawesome/free-brands-svg-icons

You also need to import the icon in vendor.ts: 您还需要将图标导入vendor.ts:

import {
    faFacebook
} from '@fortawesome/free-brands-svg-icons';
....
library.add(faFacebook);

Finally, you need to add the icon in the HTML, similar to how others are used (but specify the fab for a Brand Icon). 最后,您需要在HTML中添加图标,类似于使用其他图标的方式(但为品牌图标指定fab )。 There are several examples in the navbar for icons, a Facebook icon will look like below: 导航栏中有几个图标示例,一个Facebook图标如下所示:

<fa-icon [icon]="['fab', 'facebook']"></fa-icon>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM