選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

styles.ts 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. import { StyleSheet } from 'react-native';
  2. import ColorSchemeRegistry from '../../../color-scheme/ColorSchemeRegistry';
  3. import { schemeColor } from '../../../color-scheme/functions';
  4. import { BoxModel } from '../../../styles/components/styles/BoxModel';
  5. import BaseTheme from '../../../ui/components/BaseTheme.native';
  6. import { PREFERRED_DIALOG_SIZE } from '../../constants';
  7. const BORDER_RADIUS = 5;
  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 = BaseTheme.spacing[3];
  16. /**
  17. * Reusable (colored) style for text in any branded dialogs.
  18. */
  19. const brandedDialogText = {
  20. color: schemeColor('text'),
  21. fontSize: MD_FONT_SIZE,
  22. textAlign: 'center'
  23. };
  24. const brandedDialogLabelStyle = {
  25. color: BaseTheme.palette.text01,
  26. flexShrink: 1,
  27. fontSize: MD_FONT_SIZE,
  28. opacity: 0.90
  29. };
  30. const brandedDialogItemContainerStyle = {
  31. alignItems: 'center',
  32. flexDirection: 'row',
  33. height: MD_ITEM_HEIGHT
  34. };
  35. const brandedDialogIconStyle = {
  36. color: BaseTheme.palette.icon01,
  37. fontSize: 24
  38. };
  39. export const inputDialog = {
  40. formMessage: {
  41. alignSelf: 'flex-start',
  42. fontStyle: 'italic',
  43. fontWeight: 'bold',
  44. marginTop: BaseTheme.spacing[3]
  45. }
  46. };
  47. /**
  48. * The React {@code Component} styles of {@code BottomSheet}. These have
  49. * been implemented as per the Material Design guidelines:
  50. * {@link https://material.io/guidelines/components/bottom-sheets.html}.
  51. */
  52. export const bottomSheetStyles = {
  53. sheetAreaCover: {
  54. backgroundColor: 'transparent',
  55. flex: 1
  56. },
  57. scrollView: {
  58. paddingHorizontal: 0
  59. },
  60. /**
  61. * Style for the container of the sheet.
  62. */
  63. sheetContainer: {
  64. alignItems: 'stretch',
  65. flex: 1,
  66. flexDirection: 'column',
  67. justifyContent: 'flex-end',
  68. maxWidth: 500,
  69. marginLeft: 'auto',
  70. marginRight: 'auto',
  71. width: '100%'
  72. },
  73. sheetItemContainer: {
  74. flex: -1,
  75. maxHeight: '75%'
  76. },
  77. buttons: {
  78. /**
  79. * Style for the {@code Icon} element in a generic item of the menu.
  80. */
  81. iconStyle: {
  82. ...brandedDialogIconStyle
  83. },
  84. /**
  85. * Style for the label in a generic item rendered in the menu.
  86. */
  87. labelStyle: {
  88. ...brandedDialogLabelStyle,
  89. marginLeft: 16
  90. },
  91. /**
  92. * Container style for a generic item rendered in the menu.
  93. */
  94. style: {
  95. ...brandedDialogItemContainerStyle,
  96. paddingHorizontal: MD_ITEM_MARGIN_PADDING
  97. },
  98. /**
  99. * Additional style that is not directly used as a style object.
  100. */
  101. underlayColor: BaseTheme.palette.ui04
  102. },
  103. /**
  104. * Bottom sheet's base style.
  105. */
  106. sheet: {
  107. backgroundColor: BaseTheme.palette.ui02,
  108. borderTopLeftRadius: 16,
  109. borderTopRightRadius: 16
  110. },
  111. /**
  112. * Bottom sheet's base style with header.
  113. */
  114. sheetHeader: {
  115. backgroundColor: BaseTheme.palette.ui02
  116. },
  117. /**
  118. * Bottom sheet's background color with footer.
  119. */
  120. sheetFooter: {
  121. backgroundColor: BaseTheme.palette.ui01
  122. }
  123. };
  124. export default {
  125. dialogButton: {
  126. ...BaseTheme.typography.bodyLongBold
  127. },
  128. destructiveDialogButton: {
  129. ...BaseTheme.typography.bodyLongBold,
  130. color: BaseTheme.palette.actionDanger
  131. }
  132. };
  133. export const brandedDialog = {
  134. /**
  135. * The style of bold {@code Text} rendered by the {@code Dialog}s of the
  136. * feature authentication.
  137. */
  138. boldDialogText: {
  139. fontWeight: 'bold'
  140. },
  141. buttonFarRight: {
  142. borderBottomRightRadius: BORDER_RADIUS
  143. },
  144. buttonWrapper: {
  145. alignItems: 'stretch',
  146. borderRadius: BORDER_RADIUS,
  147. flexDirection: 'row'
  148. },
  149. mainWrapper: {
  150. alignSelf: 'stretch',
  151. padding: BoxModel.padding * 2,
  152. // The added bottom padding is to compensate the empty space around the
  153. // close icon.
  154. paddingBottom: BoxModel.padding * 3
  155. },
  156. overlayTouchable: {
  157. ...StyleSheet.absoluteFillObject
  158. }
  159. };
  160. /**
  161. * Color schemed styles for all the component based on the abstract dialog.
  162. */
  163. ColorSchemeRegistry.register('Dialog', {
  164. button: {
  165. backgroundColor: '#44A5FF',
  166. flex: 1,
  167. padding: BoxModel.padding * 1.5
  168. },
  169. /**
  170. * Separator line for the buttons in a dialog.
  171. */
  172. buttonSeparator: {
  173. borderRightColor: schemeColor('border'),
  174. borderRightWidth: 1
  175. },
  176. buttonLabel: {
  177. color: schemeColor('buttonLabel'),
  178. fontSize: MD_FONT_SIZE,
  179. textAlign: 'center'
  180. },
  181. /**
  182. * Style of the close icon on a dialog.
  183. */
  184. closeStyle: {
  185. color: schemeColor('icon'),
  186. fontSize: MD_FONT_SIZE
  187. },
  188. /**
  189. * Base style of the dialogs.
  190. */
  191. dialog: {
  192. alignItems: 'stretch',
  193. backgroundColor: schemeColor('background'),
  194. borderColor: schemeColor('border'),
  195. borderRadius: BORDER_RADIUS,
  196. borderWidth: 1,
  197. flex: 1,
  198. flexDirection: 'column',
  199. maxWidth: PREFERRED_DIALOG_SIZE
  200. },
  201. /**
  202. * Field on an input dialog.
  203. */
  204. field: {
  205. ...brandedDialogText,
  206. borderBottomWidth: 1,
  207. borderColor: schemeColor('border'),
  208. margin: BoxModel.margin,
  209. textAlign: 'left'
  210. },
  211. /**
  212. * Style for the field label on an input dialog.
  213. */
  214. fieldLabel: {
  215. ...brandedDialogText,
  216. margin: BoxModel.margin,
  217. textAlign: 'left'
  218. },
  219. text: {
  220. ...brandedDialogText,
  221. color: BaseTheme.palette.text01
  222. },
  223. topBorderContainer: {
  224. borderTopColor: BaseTheme.palette.ui07,
  225. borderTopWidth: 1
  226. }
  227. });