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.5KB

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