You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

styles.js 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. // @flow
  2. import { StyleSheet } from 'react-native';
  3. import { BoxModel, ColorPalette, createStyleSheet } from '../../../styles';
  4. import { PREFERRED_DIALOG_SIZE } from '../../constants';
  5. const BORDER_RADIUS = 5;
  6. const DIALOG_BORDER_COLOR = 'rgba(255, 255, 255, 0.2)';
  7. export const FIELD_UNDERLINE = ColorPalette.transparent;
  8. export const PLACEHOLDER_COLOR = ColorPalette.lightGrey;
  9. /**
  10. * Default styles for the items of a {@code BottomSheet}-based menu.
  11. *
  12. * These have been implemented as per the Material Design guidelines:
  13. * {@link https://material.io/guidelines/components/bottom-sheets.html}.
  14. */
  15. const bottomSheetItemStyles = createStyleSheet({
  16. /**
  17. * Container style for a generic item rendered in the menu.
  18. */
  19. style: {
  20. alignItems: 'center',
  21. flexDirection: 'row',
  22. height: 48
  23. },
  24. /**
  25. * Style for the {@code Icon} element in a generic item of the menu.
  26. */
  27. iconStyle: {
  28. color: ColorPalette.white,
  29. fontSize: 24
  30. },
  31. /**
  32. * Style for the label in a generic item rendered in the menu.
  33. */
  34. labelStyle: {
  35. color: ColorPalette.white,
  36. flexShrink: 1,
  37. fontSize: 16,
  38. marginLeft: 32,
  39. opacity: 0.90
  40. }
  41. });
  42. export const bottomSheetItemStylesCombined = {
  43. ...bottomSheetItemStyles,
  44. underlayColor: ColorPalette.overflowMenuItemUnderlay
  45. };
  46. /**
  47. * The React {@code Component} styles of {@code BottomSheet}. These have
  48. * been implemented as per the Material Design guidelines:
  49. * {@link https://material.io/guidelines/components/bottom-sheets.html}.
  50. */
  51. export const bottomSheetStyles = createStyleSheet({
  52. /**
  53. * Style for a backdrop which dims the view in the background. This view
  54. * will also be clickable. The backgroundColor is applied to the overlay
  55. * view instead, so the modal animation doesn't affect the backdrop.
  56. */
  57. backdrop: {
  58. ...StyleSheet.absoluteFillObject
  59. },
  60. /**
  61. * Style for the container of the sheet.
  62. */
  63. container: {
  64. alignItems: 'flex-end',
  65. flex: 1,
  66. flexDirection: 'row',
  67. justifyContent: 'center'
  68. },
  69. /**
  70. * Style for an overlay on top of which the sheet will be displayed.
  71. */
  72. overlay: {
  73. ...StyleSheet.absoluteFillObject,
  74. backgroundColor: 'rgba(127, 127, 127, 0.6)'
  75. },
  76. /**
  77. * Bottom sheet's base style.
  78. */
  79. sheet: {
  80. backgroundColor: 'rgb(0, 3, 6)',
  81. flex: 1,
  82. paddingHorizontal: 16,
  83. paddingVertical: 8
  84. }
  85. });
  86. export const brandedDialog = createStyleSheet({
  87. /**
  88. * The style of bold {@code Text} rendered by the {@code Dialog}s of the
  89. * feature authentication.
  90. */
  91. boldDialogText: {
  92. fontWeight: 'bold'
  93. },
  94. button: {
  95. backgroundColor: ColorPalette.blue,
  96. flex: 1,
  97. padding: BoxModel.padding * 1.5
  98. },
  99. buttonFarLeft: {
  100. borderBottomLeftRadius: BORDER_RADIUS
  101. },
  102. buttonFarRight: {
  103. borderBottomRightRadius: BORDER_RADIUS
  104. },
  105. buttonSeparator: {
  106. borderRightColor: DIALOG_BORDER_COLOR,
  107. borderRightWidth: 1
  108. },
  109. buttonWrapper: {
  110. alignItems: 'stretch',
  111. borderRadius: BORDER_RADIUS,
  112. flexDirection: 'row'
  113. },
  114. closeStyle: {
  115. color: ColorPalette.white,
  116. fontSize: 16
  117. },
  118. closeWrapper: {
  119. alignSelf: 'flex-end',
  120. padding: BoxModel.padding
  121. },
  122. dialog: {
  123. alignItems: 'stretch',
  124. backgroundColor: 'rgb(0, 3, 6)',
  125. borderColor: DIALOG_BORDER_COLOR,
  126. borderRadius: BORDER_RADIUS,
  127. borderWidth: 1,
  128. flex: 1,
  129. flexDirection: 'column',
  130. maxWidth: PREFERRED_DIALOG_SIZE
  131. },
  132. mainWrapper: {
  133. alignSelf: 'stretch',
  134. padding: BoxModel.padding * 2,
  135. // The added bottom padding is to compensate the empty space around the
  136. // close icon.
  137. paddingBottom: BoxModel.padding * 3
  138. },
  139. overlay: {
  140. ...StyleSheet.absoluteFillObject,
  141. alignItems: 'center',
  142. backgroundColor: 'rgba(127, 127, 127, 0.6)',
  143. flexDirection: 'row',
  144. justifyContent: 'center',
  145. padding: 30
  146. },
  147. text: {
  148. color: ColorPalette.white,
  149. fontSize: 16,
  150. textAlign: 'center'
  151. }
  152. });
  153. /**
  154. * The React {@code Component} styles of {@code Dialog}.
  155. */
  156. export const dialog = createStyleSheet({
  157. /**
  158. * The style of the {@code Text} in a {@code Dialog} button.
  159. */
  160. buttonText: {
  161. color: ColorPalette.blue
  162. },
  163. /**
  164. * The style of the {@code Text} in a {@code Dialog} button which is
  165. * disabled.
  166. */
  167. disabledButtonText: {
  168. color: ColorPalette.darkGrey
  169. }
  170. });
  171. export const inputDialog = createStyleSheet({
  172. bottomField: {
  173. marginBottom: 0
  174. },
  175. field: {
  176. ...brandedDialog.text,
  177. borderBottomWidth: 1,
  178. borderColor: DIALOG_BORDER_COLOR,
  179. margin: BoxModel.margin,
  180. textAlign: 'left'
  181. },
  182. fieldLabel: {
  183. ...brandedDialog.text,
  184. margin: BoxModel.margin,
  185. textAlign: 'left'
  186. },
  187. fieldWrapper: {
  188. ...brandedDialog.mainWrapper,
  189. paddingBottom: BoxModel.padding * 2
  190. }
  191. });