StartSocialAuth.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from "react"
  2. import misago from "misago"
  3. const StartSocialAuth = (props) => {
  4. const { buttonClassName, buttonLabel, formLabel, header, labelClassName } =
  5. props
  6. const socialAuth = misago.get("SOCIAL_AUTH")
  7. if (socialAuth.length === 0) return null
  8. return (
  9. <div className="form-group form-social-auth">
  10. <FormHeader className={labelClassName} text={header} />
  11. <div className="row">
  12. {socialAuth.map(({ id, name, button_text, button_color, url }) => {
  13. const className = "btn btn-block btn-default btn-social-" + id
  14. const style = button_color ? { color: button_color } : null
  15. const finalButtonLabel =
  16. button_text || interpolate(buttonLabel, { site: name }, true)
  17. return (
  18. <div className={buttonClassName || "col-xs-12"} key={id}>
  19. <a className={className} style={style} href={url}>
  20. {finalButtonLabel}
  21. </a>
  22. </div>
  23. )
  24. })}
  25. </div>
  26. <hr />
  27. <FormHeader className={labelClassName} text={formLabel} />
  28. </div>
  29. )
  30. }
  31. const FormHeader = ({ className, text }) => {
  32. if (!text) return null
  33. return <h5 className={className || ""}>{text}</h5>
  34. }
  35. export default StartSocialAuth