This is just a technology testing project based on Create React App and TailwindCSS
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

44 lines
1.4KB

  1. import React from 'react'
  2. function PrimaryButton(props) {
  3. const {type, text, action, disabled} = props
  4. return <>
  5. <button
  6. type={type||'button'}
  7. className="
  8. appearance-none
  9. flex
  10. relative
  11. w-full
  12. p-3
  13. border-0
  14. rounded-md
  15. border-primary-800
  16. bg-primary-800
  17. text-white
  18. cursor-pointer
  19. shadow-md
  20. hover:bg-primary-500
  21. focus:bg-primary-500
  22. focus:outline-none
  23. active:shadow-inner
  24. active:bg-primary-800
  25. active:transform
  26. active:translate-y-px
  27. disabled:bg-primary-800
  28. disabled:opacity-50
  29. disabled:shadow-md
  30. disabled:translate-y-0
  31. disabled:cursor-not-allowed
  32. "
  33. onClick={action}
  34. disabled={disabled}
  35. aria-disabled={disabled}
  36. >
  37. <div className="sm:text-lg flex-grow text-center px-6">{text||'Primary Button'}</div>
  38. </button>
  39. {disabled && <div tabIndex="0" className="sr-only">Disabled button: {text||'Primary Button'}. Please fill all necessary fields.</div>}
  40. </>
  41. }
  42. export default PrimaryButton