mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +08:00
feat: add some css style for the custom Provider button (#1185)
* fix: add some css style for the custom button * fix: refactor previous code * fix: add i18 adaptation * fix: modifiy the saml codition
This commit is contained in:
@ -129,6 +129,32 @@ export function renderProviderLogo(provider, application, width, margin, size, l
|
||||
);
|
||||
}
|
||||
|
||||
} else if (provider.type === "Custom") {
|
||||
// style definition
|
||||
const text = i18next.t("login:Sign in with {type}").replace("{type}", provider.displayName);
|
||||
const customAStyle = {display: "block", height: "55px", color: "#000"};
|
||||
const customButtonStyle = {display: "flex", alignItems: "center", width: "calc(100% - 10px)", height: "50px", margin: "5px", padding: "0 10px", backgroundColor: "transparent", boxShadow: "0px 1px 3px rgba(0,0,0,0.5)", border: "0px", borderRadius: "3px", cursor: "pointer"};
|
||||
const customImgStyle = {justfyContent: "space-between"};
|
||||
const customSpanStyle = {textAlign: "center", lineHeight: "50px", width: "100%", fontSize: "19px"};
|
||||
if (provider.category === "OAuth") {
|
||||
return (
|
||||
<a key={provider.displayName} href={Provider.getAuthUrl(application, provider, "signup")} style={customAStyle}>
|
||||
<button style={customButtonStyle}>
|
||||
<img width={26} src={getProviderLogoURL(provider)} alt={provider.displayName} style={customImgStyle} />
|
||||
<span style={customSpanStyle}>{text}</span>
|
||||
</button>
|
||||
</a>
|
||||
);
|
||||
} else if (provider.category === "SAML") {
|
||||
return (
|
||||
<a key={provider.displayName} onClick={() => getSamlUrl(provider, location)} style={customAStyle}>
|
||||
<button style={customButtonStyle}>
|
||||
<img width={26} src={getProviderLogoURL(provider)} alt={provider.displayName} style={customImgStyle} />
|
||||
<span style={customSpanStyle}>{text}</span>
|
||||
</button>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return (
|
||||
<div key={provider.displayName} style={{marginBottom: "10px"}}>
|
||||
|
Reference in New Issue
Block a user