ThemeTextButton.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import { StyleSheet, Text, View } from 'react-native'
  2. import React from 'react'
  3. import fonts from '../../../constants/fonts';
  4. import colors from '../../../constants/colors';
  5. import Button from '../../atoms/Buttons/Button';
  6. const ThemedTextButton = ({ theme, onPress, title, titleStyle, buttonStyle}) => {
  7. let style = {};
  8. switch (theme) {
  9. case 'primary-outline':
  10. style = {
  11. buttonStyle: {
  12. backgroundColor: colors().dominant,
  13. maxWidth: '100%',
  14. width: '100%',
  15. alignItems: 'center',
  16. borderColor: colors().primaryColor,
  17. borderRadius: 6,
  18. borderWidth: 1
  19. },
  20. buttonTextStyle: {
  21. fontFamily: fonts.type.medium,
  22. color: colors().secondaryColor,
  23. }
  24. }
  25. break;
  26. case 'secondary-outline':
  27. style = {
  28. buttonStyle: {
  29. backgroundColor: colors().dominant,
  30. maxWidth: '100%',
  31. width: '100%',
  32. alignItems: 'center',
  33. borderColor: colors().secondaryColor,
  34. borderRadius: 6,
  35. borderWidth: 1
  36. },
  37. buttonTextStyle: {
  38. fontFamily: fonts.type.medium,
  39. color: colors().primaryColor,
  40. }
  41. }
  42. break;
  43. case 'secondary-contained':
  44. style = {
  45. buttonStyle: {
  46. backgroundColor: colors().secondaryColor,
  47. maxWidth: '100%',
  48. width: '100%',
  49. alignItems: 'center',
  50. borderRadius: 6,
  51. },
  52. buttonTextStyle: {
  53. fontFamily: fonts.type.medium,
  54. color: colors().white,
  55. }
  56. }
  57. break;
  58. case "white":
  59. style = {
  60. buttonStyle: {
  61. backgroundColor: colors().white_variant,
  62. maxWidth: '100%',
  63. width: '100%',
  64. alignItems: 'center',
  65. borderRadius: 6,
  66. },
  67. buttonTextStyle: {
  68. fontFamily: fonts.type.medium,
  69. color: colors().black,
  70. }
  71. }
  72. break
  73. case "black":
  74. style = {
  75. buttonStyle: {
  76. backgroundColor: colors().black_variant,
  77. maxWidth: '100%',
  78. width: '100%',
  79. alignItems: 'center'
  80. },
  81. buttonTextStyle: {
  82. fontFamily: fonts.type.medium,
  83. color: colors().white,
  84. }
  85. }
  86. break
  87. case 'primary-contained':
  88. default:
  89. style = {
  90. buttonStyle: {
  91. backgroundColor: colors().primaryColor,
  92. maxWidth: '100%',
  93. width: '100%',
  94. alignItems: 'center'
  95. },
  96. buttonTextStyle: {
  97. fontFamily: fonts.type.medium,
  98. color: colors().white,
  99. }
  100. }
  101. break;
  102. }
  103. const styles = StyleSheet.create(style)
  104. return (
  105. <Button
  106. onPress={onPress}
  107. style={[styles.buttonStyle, buttonStyle]}
  108. >
  109. <Text style={[styles.buttonTextStyle, titleStyle]}>
  110. {title}
  111. </Text>
  112. </Button>
  113. )
  114. }
  115. export default ThemedTextButton