@mycause/ui 0.0.0-ce837d6b → 0.0.0-cf96d552

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/CHANGELOG.md +225 -0
  2. package/README.md +9 -0
  3. package/dist/components/button-select/button-select.d.ts +12 -0
  4. package/dist/components/button-select/button-select.stories.d.ts +13 -0
  5. package/dist/components/button-select/index.d.ts +1 -0
  6. package/dist/components/campaign-card/campaign-card.d.ts +9 -0
  7. package/dist/components/campaign-card/campaign-card.stories.d.ts +14 -0
  8. package/dist/components/campaign-card/index.d.ts +1 -0
  9. package/dist/components/campaign-of-month/campaign-of-month.d.ts +12 -0
  10. package/dist/components/campaign-of-month/campaign-of-month.stories.d.ts +14 -0
  11. package/dist/components/campaign-of-month/index.d.ts +1 -0
  12. package/dist/components/campain-card/campain-card.d.ts +9 -0
  13. package/dist/components/campain-card/campain-card.stories.d.ts +14 -0
  14. package/dist/components/charity-card/charity-card.d.ts +7 -0
  15. package/dist/components/charity-card/charity-card.stories.d.ts +14 -0
  16. package/dist/components/charity-card/index.d.ts +1 -0
  17. package/dist/components/combo-field/combo-field.d.ts +4 -1
  18. package/dist/components/comment-section/comment-section.d.ts +23 -0
  19. package/dist/components/comment-section/comment-section.stories.d.ts +13 -0
  20. package/dist/components/comment-section/index.d.ts +1 -0
  21. package/dist/components/comment-section/sub-comments.d.ts +6 -0
  22. package/dist/components/cropper/cropper.d.ts +5 -4
  23. package/dist/components/cropper/cropper.stories.d.ts +1 -2
  24. package/dist/components/date-picker/single-date-picker.d.ts +3 -2
  25. package/dist/components/donate-card/donate-card.d.ts +8 -0
  26. package/dist/components/donate-card/donate-card.stories.d.ts +14 -0
  27. package/dist/components/donate-card/index.d.ts +1 -0
  28. package/dist/components/donation-form/donation-details.d.ts +12 -0
  29. package/dist/components/donation-form/donation-form.d.ts +64 -0
  30. package/dist/components/{phone-number-field/phone-number-field.stories.d.ts → donation-form/donation-form.stories.d.ts} +1 -1
  31. package/dist/components/donation-form/donation-payment.d.ts +13 -0
  32. package/dist/components/donation-form/donation-select.d.ts +13 -0
  33. package/dist/components/donation-form/index.d.ts +1 -0
  34. package/dist/components/elevation/elevation.d.ts +2 -1
  35. package/dist/components/featured-campaign-card /featured-campaign-card.d.ts +14 -0
  36. package/dist/components/featured-campaign-card /featured-campaign-card.stories.d.ts +14 -0
  37. package/dist/components/featured-campaign-card /index.d.ts +1 -0
  38. package/dist/components/featured-campain-card /featured-campain-card .stories.d.ts +14 -0
  39. package/dist/components/featured-campain-card /featured-campain-card.d.ts +14 -0
  40. package/dist/components/fundraising-section/fundraising-section.d.ts +9 -0
  41. package/dist/components/fundraising-section/fundraising-section.stories.d.ts +14 -0
  42. package/dist/components/fundraising-section/index.d.ts +1 -0
  43. package/dist/components/hero-banner/hero-banner.d.ts +9 -0
  44. package/dist/components/hero-banner/hero-banner.stories.d.ts +14 -0
  45. package/dist/components/hero-banner/index.d.ts +1 -0
  46. package/dist/components/horizontalbar/horizontalbar.d.ts +11 -0
  47. package/dist/components/horizontalbar/horizontalbar.stories.d.ts +26 -0
  48. package/dist/components/horizontalbar/index.d.ts +1 -0
  49. package/dist/components/icon/heart-toggle.d.ts +11 -0
  50. package/dist/components/icon/heart-toggle.stories.d.ts +13 -0
  51. package/dist/components/icon/index.d.ts +1 -1
  52. package/dist/components/index.d.ts +6 -1
  53. package/dist/components/list/list.d.ts +29 -14
  54. package/dist/components/list/list.stories.d.ts +8 -2
  55. package/dist/components/login/index.d.ts +1 -0
  56. package/dist/components/login/login.d.ts +15 -0
  57. package/dist/components/login/login.stories.d.ts +19 -0
  58. package/dist/components/modal/modal.d.ts +4 -3
  59. package/dist/components/modal/modal.stories.d.ts +6 -0
  60. package/dist/components/nav/index.d.ts +1 -0
  61. package/dist/components/nav/nav-actions.d.ts +5 -0
  62. package/dist/components/nav/nav-bar.d.ts +7 -0
  63. package/dist/components/nav/nav-call-to-action.d.ts +5 -0
  64. package/dist/components/nav/nav-expanded.d.ts +11 -0
  65. package/dist/components/nav/nav-list.d.ts +27 -0
  66. package/dist/components/nav/nav-menu-control.d.ts +7 -0
  67. package/dist/components/nav/nav-menu.d.ts +12 -0
  68. package/dist/components/nav/nav-search-control.d.ts +7 -0
  69. package/dist/components/nav/nav-search.d.ts +9 -0
  70. package/dist/components/nav/nav-sign-in-control.d.ts +11 -0
  71. package/dist/components/nav/nav-user-menu-items.d.ts +20 -0
  72. package/dist/components/nav/nav-user-menu.d.ts +18 -0
  73. package/dist/components/nav/nav.d.ts +55 -0
  74. package/dist/components/nav/nav.stories.d.ts +11 -0
  75. package/dist/components/navigation/navigation-list.d.ts +3 -1
  76. package/dist/components/navigation/navigation-menu.d.ts +2 -1
  77. package/dist/components/navigation/navigation-sign-in-control.d.ts +6 -3
  78. package/dist/components/navigation/navigation.d.ts +12 -1
  79. package/dist/components/navigation/navigation.stories.d.ts +3 -21
  80. package/dist/components/phone-number-input/index.d.ts +2 -0
  81. package/dist/components/{phone-number-field/phone-number-field.d.ts → phone-number-input/phone-number-input.d.ts} +5 -3
  82. package/dist/components/phone-number-input/phone-number-input.stories.d.ts +13 -0
  83. package/dist/components/{phone-number-field → phone-number-input}/util.d.ts +0 -0
  84. package/dist/components/popup/index.d.ts +1 -0
  85. package/dist/components/popup/popup.d.ts +8 -0
  86. package/dist/components/popup/popup.stories.d.ts +14 -0
  87. package/dist/components/progressbar/index.d.ts +1 -0
  88. package/dist/components/progressbar/progressbar.d.ts +8 -0
  89. package/dist/components/progressbar/progressbar.stories.d.ts +14 -0
  90. package/dist/components/select/select.d.ts +2 -1
  91. package/dist/components/spinner/index.d.ts +1 -0
  92. package/dist/components/spinner/spinner.d.ts +8 -0
  93. package/dist/components/spinner/spinner.stories.d.ts +13 -0
  94. package/dist/components/start-campaign-card/index.d.ts +1 -0
  95. package/dist/components/start-campaign-card/start-campaign-card.d.ts +8 -0
  96. package/dist/components/start-campaign-card/start-campaign-card.stories.d.ts +14 -0
  97. package/dist/components/start-campain-card/start-campain-card.d.ts +8 -0
  98. package/dist/components/start-campain-card/start-campain-card.stories.d.ts +14 -0
  99. package/dist/components/statistics/statistics.d.ts +2 -1
  100. package/dist/components/tabs/tabs.d.ts +3 -1
  101. package/dist/components/text/text.d.ts +1 -1
  102. package/dist/components/text-field/text-field.d.ts +1 -0
  103. package/dist/index.esm.js +5298 -4190
  104. package/dist/index.js +4872 -3759
  105. package/dist/utils/parse-numbers.d.ts +2 -0
  106. package/package.json +4 -1
  107. package/styles/index.css +1 -0
  108. package/dist/components/anchor/anchor.jsx +0 -35
  109. package/dist/components/anchor/anchor.stories.jsx +0 -12
  110. package/dist/components/anchor/bold-anchor.jsx +0 -33
  111. package/dist/components/anchor/bold-anchor.stories.jsx +0 -11
  112. package/dist/components/anchor/index.js +0 -2
  113. package/dist/components/avatar/avatar.jsx +0 -14
  114. package/dist/components/avatar/avatar.stories.jsx +0 -17
  115. package/dist/components/avatar/image-avatar.jsx +0 -29
  116. package/dist/components/avatar/index.js +0 -1
  117. package/dist/components/avatar/text-avatar.jsx +0 -47
  118. package/dist/components/button/button.jsx +0 -85
  119. package/dist/components/button/button.stories.jsx +0 -118
  120. package/dist/components/button/index.js +0 -1
  121. package/dist/components/checkbox/checkbox.jsx +0 -39
  122. package/dist/components/checkbox/checkbox.stories.jsx +0 -42
  123. package/dist/components/checkbox/index.js +0 -1
  124. package/dist/components/chips/chip.jsx +0 -30
  125. package/dist/components/chips/chips.jsx +0 -16
  126. package/dist/components/chips/chips.stories.jsx +0 -35
  127. package/dist/components/chips/index.js +0 -3
  128. package/dist/components/chips/input-chips.jsx +0 -16
  129. package/dist/components/chips/input-chips.stories.jsx +0 -39
  130. package/dist/components/combo-field/combo-field-expander.jsx +0 -23
  131. package/dist/components/combo-field/combo-field.jsx +0 -93
  132. package/dist/components/combo-field/combo-field.stories.jsx +0 -62
  133. package/dist/components/combo-field/index.js +0 -2
  134. package/dist/components/cropper/cropper.jsx +0 -15
  135. package/dist/components/cropper/cropper.stories.jsx +0 -18
  136. package/dist/components/cropper/index.js +0 -1
  137. package/dist/components/date-picker/date-picker.jsx +0 -74
  138. package/dist/components/date-picker/date-picker.stories.jsx +0 -46
  139. package/dist/components/date-picker/index.js +0 -2
  140. package/dist/components/date-picker/single-date-picker.jsx +0 -81
  141. package/dist/components/elevation/elevation.jsx +0 -19
  142. package/dist/components/elevation/elevation.stories.jsx +0 -31
  143. package/dist/components/elevation/index.js +0 -1
  144. package/dist/components/field-helpers/field-helper-text.jsx +0 -42
  145. package/dist/components/field-helpers/field-label.jsx +0 -29
  146. package/dist/components/field-helpers/index.js +0 -2
  147. package/dist/components/icon/btn_google_light_normal_ios.svg.jsx +0 -21
  148. package/dist/components/icon/facebook_6.svg.jsx +0 -13
  149. package/dist/components/icon/icon-button-group.jsx +0 -51
  150. package/dist/components/icon/icon-button-group.stories.jsx +0 -26
  151. package/dist/components/icon/icon-button.jsx +0 -48
  152. package/dist/components/icon/icon-button.stories.jsx +0 -33
  153. package/dist/components/icon/icon.jsx +0 -49
  154. package/dist/components/icon/icon.stories.jsx +0 -78
  155. package/dist/components/icon/index.js +0 -4
  156. package/dist/components/icon/material-icon.jsx +0 -18
  157. package/dist/components/icon/toggle-button.jsx +0 -29
  158. package/dist/components/icon/toggle-button.stories.jsx +0 -16
  159. package/dist/components/index.js +0 -27
  160. package/dist/components/layout/box.jsx +0 -58
  161. package/dist/components/layout/flex.jsx +0 -55
  162. package/dist/components/layout/flex.stories.jsx +0 -44
  163. package/dist/components/layout/grid.jsx +0 -19
  164. package/dist/components/layout/grid.stories.jsx +0 -29
  165. package/dist/components/layout/index.js +0 -4
  166. package/dist/components/layout/stack.jsx +0 -33
  167. package/dist/components/layout/stack.stories.jsx +0 -40
  168. package/dist/components/list/index.js +0 -1
  169. package/dist/components/list/list.jsx +0 -52
  170. package/dist/components/list/list.stories.jsx +0 -135
  171. package/dist/components/logo/index.js +0 -1
  172. package/dist/components/logo/logo-type.jsx +0 -65
  173. package/dist/components/menu/index.js +0 -8
  174. package/dist/components/menu/menu-list-divider.jsx +0 -2
  175. package/dist/components/menu/menu-list-item-graphic.jsx +0 -2
  176. package/dist/components/menu/menu-list-item-meta.jsx +0 -2
  177. package/dist/components/menu/menu-list-item-text.jsx +0 -2
  178. package/dist/components/menu/menu-list-item.jsx +0 -11
  179. package/dist/components/menu/menu-list.jsx +0 -18
  180. package/dist/components/menu/menu-surface.jsx +0 -4
  181. package/dist/components/menu/menu.jsx +0 -2
  182. package/dist/components/menu/menu.stories.jsx +0 -42
  183. package/dist/components/modal/index.js +0 -1
  184. package/dist/components/modal/modal.jsx +0 -49
  185. package/dist/components/modal/modal.stories.jsx +0 -47
  186. package/dist/components/navigation/index.js +0 -1
  187. package/dist/components/navigation/navigation-actions.jsx +0 -8
  188. package/dist/components/navigation/navigation-bar.jsx +0 -42
  189. package/dist/components/navigation/navigation-call-to-action.jsx +0 -6
  190. package/dist/components/navigation/navigation-expanded.jsx +0 -165
  191. package/dist/components/navigation/navigation-list.jsx +0 -126
  192. package/dist/components/navigation/navigation-menu-control.jsx +0 -25
  193. package/dist/components/navigation/navigation-menu.jsx +0 -103
  194. package/dist/components/navigation/navigation-search-control.jsx +0 -8
  195. package/dist/components/navigation/navigation-search.jsx +0 -63
  196. package/dist/components/navigation/navigation-sign-in-control.jsx +0 -14
  197. package/dist/components/navigation/navigation-user-menu-items.jsx +0 -36
  198. package/dist/components/navigation/navigation-user-menu.jsx +0 -121
  199. package/dist/components/navigation/navigation.jsx +0 -137
  200. package/dist/components/navigation/navigation.stories.jsx +0 -260
  201. package/dist/components/phone-number-field/index.d.ts +0 -2
  202. package/dist/components/phone-number-field/index.js +0 -2
  203. package/dist/components/phone-number-field/phone-number-field.jsx +0 -50
  204. package/dist/components/phone-number-field/phone-number-field.stories.jsx +0 -23
  205. package/dist/components/phone-number-field/util.js +0 -19
  206. package/dist/components/radio/index.js +0 -2
  207. package/dist/components/radio/radio-group.jsx +0 -9
  208. package/dist/components/radio/radio-group.stories.jsx +0 -21
  209. package/dist/components/radio/radio.jsx +0 -31
  210. package/dist/components/radio/radio.stories.jsx +0 -44
  211. package/dist/components/select/index.js +0 -2
  212. package/dist/components/select/select-helper-text.jsx +0 -6
  213. package/dist/components/select/select.jsx +0 -152
  214. package/dist/components/select/select.stories.jsx +0 -40
  215. package/dist/components/statistics/index.js +0 -1
  216. package/dist/components/statistics/statistics.jsx +0 -61
  217. package/dist/components/statistics/statistics.stories.jsx +0 -34
  218. package/dist/components/switch/index.js +0 -1
  219. package/dist/components/switch/switch.jsx +0 -32
  220. package/dist/components/switch/switch.stories.jsx +0 -41
  221. package/dist/components/tabs/index.js +0 -1
  222. package/dist/components/tabs/tab-bar.jsx +0 -35
  223. package/dist/components/tabs/tab-text-label.jsx +0 -5
  224. package/dist/components/tabs/tab.jsx +0 -50
  225. package/dist/components/tabs/tabs.jsx +0 -65
  226. package/dist/components/tabs/tabs.stories.jsx +0 -27
  227. package/dist/components/text/index.js +0 -1
  228. package/dist/components/text/text.jsx +0 -138
  229. package/dist/components/text/text.stories.jsx +0 -262
  230. package/dist/components/text-field/index.js +0 -2
  231. package/dist/components/text-field/text-field-helper-text.jsx +0 -8
  232. package/dist/components/text-field/text-field.jsx +0 -124
  233. package/dist/components/text-field/text-field.stories.jsx +0 -32
  234. package/dist/components/uploader/index.js +0 -1
  235. package/dist/components/uploader/uploader.jsx +0 -96
  236. package/dist/input.d.ts +0 -1
  237. package/dist/input.js +0 -4
  238. package/dist/input.jsx +0 -4
  239. package/dist/theme/colors.js +0 -9
  240. package/dist/theme/index.js +0 -2
  241. package/dist/theme/mycause-theme.js +0 -33
  242. package/dist/theme/theme.jsx +0 -36
  243. package/dist/utils/browser.js +0 -19
  244. package/dist/utils/center-decorator.jsx +0 -15
  245. package/dist/utils/component-matrix.jsx +0 -39
  246. package/dist/utils/flags.js +0 -18
  247. package/dist/utils/grid-decorator.jsx +0 -27
  248. package/dist/utils/tap-event.js +0 -11
  249. package/dist/utils/wrap.js +0 -8
@@ -1,165 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import { Icon } from "../icon";
4
- import IconButton from "../icon/icon-button";
5
- import { BACKGROUND_GREY, ON_BACKGROUND_GREY_GREY } from "../../theme/colors";
6
- import NavigationList from "./navigation-list";
7
- function NavigationExpanded({ links, children, onRequestClose, className, banner, }) {
8
- return (<div className={classnames("navigation-menu", className)}>
9
- <div className="content">
10
- {children}
11
- <div>
12
- <hr />
13
- </div>
14
- <div className="columns">
15
- <div className="navigation-list-container">
16
- {links ? <NavigationList items={links}/> : null}
17
- </div>
18
- {banner ? <div className="banner">{banner}</div> : null}
19
- </div>
20
- <div className="close">
21
- <IconButton className="close-button" onClick={onRequestClose}>
22
- <Icon icon="close" size="100%" title="Close"/>
23
- </IconButton>
24
- </div>
25
- </div>
26
- <style jsx>{`
27
- .navigation-menu {
28
- background-color: ${BACKGROUND_GREY};
29
- }
30
-
31
- .navigation-list-container {
32
- flex-grow: 1;
33
- }
34
-
35
- .content {
36
- position: relative;
37
- max-width: 1024px;
38
- margin: 0 auto;
39
- padding: 0rem 1rem 2rem 1rem;
40
- }
41
-
42
- .content > :global(*:not(:last-child)) {
43
- margin-bottom: 1rem;
44
- }
45
-
46
- .content {
47
- display: grid;
48
- grid-gap: 1rem;
49
- }
50
-
51
- .content > :global(*:not(:last-child)) {
52
- margin-bottom: initial;
53
- }
54
-
55
- .main-navigation {
56
- display: flex;
57
- flex-direction: column;
58
- }
59
-
60
- .main-navigation > :global(*:not(:last-child)) {
61
- margin-bottom: 2rem;
62
- }
63
-
64
- .main-navigation-menus {
65
- display: flex;
66
- }
67
-
68
- .main-navigation-menus > :global(*:not(:last-child)) {
69
- margin-right: 4rem;
70
- }
71
-
72
- .columns {
73
- display: flex;
74
- padding: 0;
75
- }
76
-
77
- .columns > :global(*:not(:last-child)) {
78
- margin-right: 8rem;
79
- }
80
-
81
- .span-2 {
82
- flex-grow: 1;
83
- }
84
-
85
- .columns > :global(:not:(:last-child)) {
86
- margin-right: initial;
87
- }
88
-
89
- .span-2 {
90
- grid-column-end: span 2;
91
- }
92
-
93
- .close {
94
- display: none;
95
- }
96
-
97
- .navigation-menu :global(.close-button) {
98
- padding: 6px !important;
99
- font-size: 36px;
100
- }
101
-
102
- .banner {
103
- display: none;
104
- }
105
-
106
- hr {
107
- border: none;
108
- border-top-style: solid;
109
- border-top-width: 1px;
110
- border-color: ${ON_BACKGROUND_GREY_GREY};
111
- color: ${ON_BACKGROUND_GREY_GREY};
112
- background-color: ${ON_BACKGROUND_GREY_GREY};
113
- margin: 0;
114
- }
115
-
116
- @media (min-width: 720px) {
117
- .content {
118
- padding: 2rem;
119
- }
120
-
121
- .content > :global(*:not(:last-child)) {
122
- margin-bottom: 1.5rem;
123
- }
124
-
125
- .content {
126
- grid-gap: 1.5rem;
127
- }
128
-
129
- .columns {
130
- display: flex;
131
- }
132
-
133
- .banner {
134
- display: block;
135
- }
136
- }
137
-
138
- @media (min-width: 960px) {
139
- .content {
140
- padding: 4rem;
141
- }
142
-
143
- .content > :global(*:not(:last-child)) {
144
- margin-bottom: 3rem;
145
- }
146
-
147
- .content > :global(*:not(:last-child)) {
148
- margin-bottom: 0;
149
- }
150
-
151
- .content {
152
- grid-gap: 3rem;
153
- }
154
-
155
- .close {
156
- display: block;
157
- position: absolute;
158
- top: 4rem;
159
- right: 4rem;
160
- }
161
- }
162
- `}</style>
163
- </div>);
164
- }
165
- export default NavigationExpanded;
@@ -1,126 +0,0 @@
1
- import React, { Fragment } from "react";
2
- import { BRAND_DARK_GREY, INACTIVE_GREY } from "../../theme/colors";
3
- import { BoldAnchor } from "../anchor/index";
4
- import { Icon } from "../icon/index";
5
- import { useTheme } from "../../theme/theme";
6
- function NavigationList({ items, onClickItem, active, size = "normal", }) {
7
- const theme = useTheme();
8
- return (<ul className={`size-${size}`}>
9
- {items.map(item => {
10
- const onClick = (e) => {
11
- // href
12
- if ("href" in item)
13
- return;
14
- e.preventDefault();
15
- // combined handler
16
- if (onClickItem)
17
- onClickItem(item.id);
18
- // individual handler
19
- else if (item.onClick)
20
- item.onClick();
21
- };
22
- const href = "href" in item ? item.href : "#";
23
- const id = "id" in item ? item.id : null;
24
- return (<Fragment key={"href" in item ? item.href : item.id}>
25
- <li className="item">
26
- <BoldAnchor analyticsId={item.analyticsId} href={href} onClick={onClick} active={id === active}>
27
- {item.label}{" "}
28
- {"id" in item && item.more ? (<span className="chevron">
29
- <span className="chevron-right">
30
- <Icon icon="chevron_right" size={size === "normal" ? "24px" : "36px"}/>
31
- </span>
32
- <span className="chevron-down">
33
- <Icon icon="expand_more" size={size === "normal" ? "16px" : "24px"}/>
34
- </span>
35
- </span>) : null}
36
- </BoldAnchor>
37
- </li>
38
- {"children" in item ? item.children : null}
39
- </Fragment>);
40
- })}
41
- <style jsx>{`
42
- ul {
43
- margin: 0;
44
- padding: 0;
45
- list-style: none;
46
- }
47
-
48
- .item {
49
- display: flex;
50
- flex-direction: column;
51
- justify-content: center;
52
- font-family: ${theme.typography.fontFamily.brand};
53
- color: ${BRAND_DARK_GREY};
54
- font-weight: 500;
55
- }
56
-
57
- .size-large .item {
58
- font-size: 1rem;
59
- height: 2.5rem;
60
- }
61
-
62
- .size-normal .item {
63
- font-size: 0.875rem;
64
- height: 1.75rem;
65
- }
66
-
67
- .item :global(a:focus) {
68
- outline: none;
69
- }
70
-
71
- .item:focus-within {
72
- outline: -webkit-focus-ring-color auto 5px;
73
- }
74
-
75
- .chevron {
76
- position: relative;
77
- display: inline-block;
78
- width: 1em;
79
- height: 1em;
80
- margin-left: 1rem;
81
- vertical-align: middle;
82
- line-height: 1;
83
- transform: translateY(-5%);
84
- color: ${INACTIVE_GREY};
85
- }
86
-
87
- .chevron-right {
88
- display: none;
89
- }
90
-
91
- .item :global(a:hover) .chevron,
92
- .item :global(a:focus) .chevron,
93
- .item :global(a.active) .chevron {
94
- color: inherit;
95
- }
96
-
97
- .chevron > :global(*) {
98
- position: absolute;
99
- top: 50%;
100
- left: 50%;
101
- transform: translate(-50%, -50%);
102
- }
103
-
104
- @media (min-width: 720px) {
105
- .size-large .item {
106
- font-size: 1.375rem;
107
- min-height: 3rem;
108
- }
109
-
110
- .size-normal .item {
111
- font-size: 1.125rem;
112
- min-height: 2.5rem;
113
- }
114
-
115
- .chevron-right {
116
- display: initial;
117
- }
118
-
119
- .chevron-down {
120
- display: none;
121
- }
122
- }
123
- `}</style>
124
- </ul>);
125
- }
126
- export default NavigationList;
@@ -1,25 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import { ON_BACKGROUND_GREY_GREY } from "../../theme/colors";
4
- import { ToggleButton, Icon } from "../icon";
5
- function NavigationMenuControl({ isMenuOpen, onChangeMenuOpen, className, ...rest }) {
6
- return (<div className={classnames("menu-control", className)} {...rest}>
7
- <ToggleButton active={<Icon icon="menu"/>} inactive={<Icon icon="close"></Icon>} value={isMenuOpen} onChange={onChangeMenuOpen}/>
8
- <style jsx>{`
9
- .menu-control {
10
- display: flex;
11
- align-items: center;
12
- }
13
-
14
- .menu-control::before {
15
- content: "";
16
- display: inline-block;
17
- width: 1px;
18
- height: 2rem;
19
- border-left: 1px solid ${ON_BACKGROUND_GREY_GREY};
20
- margin-right: calc(0.5rem - 1px);
21
- }
22
- `}</style>
23
- </div>);
24
- }
25
- export default NavigationMenuControl;
@@ -1,103 +0,0 @@
1
- import React from "react";
2
- import Button from "../button/button";
3
- import { BACKGROUND_GREY, ON_BACKGROUND_GREY_GREY } from "../../theme/colors";
4
- import NavigationList from "./navigation-list";
5
- export function NavigationMenu({ links, sublinks, action, active, onClickItem, }) {
6
- return (<div className="navigation-menu">
7
- <div className="main-navigation">
8
- <div className="main-navigation-menus">
9
- <NavigationList items={links.map(link => ({
10
- ...link,
11
- children: sublinks && "id" in link && link.id === active ? (<div className="inline-submenu">
12
- <NavigationList items={sublinks} active={null}/>
13
- </div>) : null,
14
- }))} onClickItem={onClickItem} active={active} size="large"/>
15
- {sublinks ? (<div className="side-submenu">
16
- <NavigationList items={sublinks} active={null}/>
17
- </div>) : null}
18
- </div>
19
- {action ? (<div>
20
- <Button display outlined color="primary" analyticsId={action.analyticsId} onClick={(e) => {
21
- /**
22
- * Prevent nav action button to turn into a hyperlink.
23
- * This is so that google analytics will always be triggered.
24
- * If we use a hyperlink instead of button clicks on the label
25
- * wont be considered as a click on the hyperlink.
26
- */
27
- if ("href" in action)
28
- window.location.href = action.href;
29
- e.preventDefault();
30
- if ("onClick" in action && action.onClick)
31
- action.onClick();
32
- }}>
33
- {action.label}
34
- </Button>
35
- </div>) : null}
36
- </div>
37
- <style jsx>{`
38
- .navigation-menu {
39
- background-color: ${BACKGROUND_GREY};
40
- }
41
-
42
- .side-submenu {
43
- display: none;
44
- padding-left: 3rem;
45
- border-left: 1px solid ${ON_BACKGROUND_GREY_GREY};
46
- }
47
-
48
- .inline-submenu {
49
- padding: 0 1rem 1rem 1rem;
50
- }
51
-
52
- .content {
53
- position: relative;
54
- max-width: 1024px;
55
- margin: 0 auto;
56
- padding: 4rem;
57
- }
58
-
59
- .content > :global(*:not(:last-child)) {
60
- margin-bottom: 3rem;
61
- }
62
-
63
- @supports (display: grid) {
64
- .content {
65
- display: grid;
66
- grid-gap: 3rem;
67
- }
68
-
69
- .content > :global(*:not(:last-child)) {
70
- margin-bottom: initial;
71
- }
72
- }
73
-
74
- .main-navigation {
75
- display: flex;
76
- flex-direction: column;
77
- }
78
-
79
- .main-navigation > :global(*:not(:last-child)) {
80
- margin-bottom: 2rem;
81
- }
82
-
83
- .main-navigation-menus {
84
- display: flex;
85
- }
86
-
87
- .main-navigation-menus > :global(*:not(:last-child)) {
88
- margin-right: 3rem;
89
- }
90
-
91
- @media (min-width: 720px) {
92
- .side-submenu {
93
- display: initial;
94
- }
95
-
96
- .inline-submenu {
97
- display: none;
98
- }
99
- }
100
- `}</style>
101
- </div>);
102
- }
103
- export default NavigationMenu;
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { IconButton, Icon } from "../icon";
3
- function NavigationSearchControl({ onChangeSearchOpen, analyticsId, }) {
4
- return (<IconButton id={analyticsId} onClick={() => onChangeSearchOpen(true)}>
5
- <Icon icon="search"/>
6
- </IconButton>);
7
- }
8
- export default NavigationSearchControl;
@@ -1,63 +0,0 @@
1
- import React, { useRef, useEffect } from "react";
2
- import { TextField } from "../text-field";
3
- import { Icon } from "../icon";
4
- import { Button } from "../button";
5
- import useMedia from "use-media";
6
- function NavigationSearch({ value, onChange, onSubmit, onCancel, }) {
7
- // Focus the search bar when opened
8
- const input = useRef(null);
9
- useEffect(() => {
10
- if (input.current) {
11
- input.current.focus();
12
- }
13
- }, [input]);
14
- const handleKeyDown = (e) => {
15
- if (e.key === "Enter") {
16
- e.preventDefault();
17
- onSubmit();
18
- }
19
- };
20
- const handleChange = (e) => {
21
- onChange(e.currentTarget.value);
22
- };
23
- const placeholder = "Try searching for a friend, campaign, or event";
24
- const isMobile = useMedia("screen and (max-width: 719px)");
25
- const isCompact = useMedia("screen and (max-width: 959px)");
26
- return (<>
27
- <div className="navigation-search">
28
- {!isCompact ? (<TextField leadingIcon={<Icon icon="search"/>} trailingIcon={<Icon icon="close" title="close"/>} onTrailingIconSelect={() => onCancel()} onChange={handleChange} onKeyDown={handleKeyDown} value={value} placeholder={placeholder} ref={input} large/>) : (<>
29
- <TextField leadingIcon={<Icon icon="search"/>} trailingIcon={value ? <Icon icon="cancel" title="clear"/> : undefined} onTrailingIconSelect={() => onChange("")} onChange={(e) => onChange(e.currentTarget.value)} onKeyDown={handleKeyDown} value={value} placeholder={!isMobile ? placeholder : "Search"} ref={input}/>
30
- <div className="cancel">
31
- <Button onClick={() => onCancel()}>Cancel</Button>
32
- </div>
33
- </>)}
34
- </div>
35
- <style jsx>{`
36
- .navigation-search {
37
- height: 100%;
38
- width: 100%;
39
- display: flex;
40
- align-items: center;
41
- }
42
-
43
- .navigation-search > :global(*:first-child) {
44
- flex-grow: 1;
45
- }
46
-
47
- .cancel {
48
- margin-left: 0.5rem;
49
- }
50
-
51
- .cancel :global(.button) {
52
- height: 3.5rem;
53
- }
54
-
55
- @media (min-width: 720px) {
56
- .navigation-search {
57
- padding: 0 1rem;
58
- }
59
- }
60
- `}</style>
61
- </>);
62
- }
63
- export default NavigationSearch;
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import { Button } from "../button";
4
- import { IconButton, Icon } from "../icon";
5
- function NavigationSignInControl({ analyticsId, onRequestSignIn, compact, className, ...rest }) {
6
- return (<div className={classnames("sign-in-control", className)} {...rest}>
7
- {!compact ? (<Button analyticsId={analyticsId} className="sign-in-button" color="neutral" icon={<Icon icon="perm_identity" color="accent"/>} onClick={() => onRequestSignIn()} display>
8
- Login
9
- </Button>) : (<IconButton id={analyticsId} title="Sign in" color="accent" onClick={() => onRequestSignIn()}>
10
- <Icon icon="perm_identity"/>
11
- </IconButton>)}
12
- </div>);
13
- }
14
- export default NavigationSignInControl;
@@ -1,36 +0,0 @@
1
- import React, { Fragment, useState } from "react";
2
- import Icon from "../icon/icon";
3
- import { MenuListItem, MenuListItemText, MenuListItemGraphic, MenuListItemMeta, } from "../menu";
4
- function NavigationUserMenuItem({ icon, label, onClick, submenu, isSubmenuOpen, ...rest }) {
5
- return (<Fragment>
6
- <MenuListItem onClick={onClick} {...rest}>
7
- <MenuListItemGraphic graphic={<Icon color="primary" {...icon}/>}/>
8
- <MenuListItemText primaryText={label}/>
9
- {submenu ? (<MenuListItemMeta meta={<Icon color="primary" icon={isSubmenuOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"}/>}/>) : null}
10
- </MenuListItem>
11
- {submenu && isSubmenuOpen
12
- ? submenu.map(subItem => (<MenuListItem key={subItem.id || subItem.href} {...subItem}>
13
- <MenuListItemText primaryText={subItem.label} className="icon-submenu"/>
14
- </MenuListItem>))
15
- : null}
16
- </Fragment>);
17
- }
18
- function NavigationUserMenuItems({ items }) {
19
- // To keep track of which submenu (if any) is open at any time
20
- // There can be only one open at a time
21
- const [activeSubmenu, setActiveSubmenu] = useState(-1);
22
- const handleClick = (index, item) => {
23
- if (item.submenu) {
24
- setActiveSubmenu(activeSubmenu === index ? -1 : index);
25
- }
26
- else if (item.onClick) {
27
- item.onClick();
28
- }
29
- };
30
- return (<Fragment>
31
- {items.map((item, i) => {
32
- return (<NavigationUserMenuItem key={item.id || item.href || i} id={item.id || item.href} isSubmenuOpen={item.submenu && activeSubmenu === i} {...item} onClick={() => handleClick(i, item)}/>);
33
- })}
34
- </Fragment>);
35
- }
36
- export default NavigationUserMenuItems;
@@ -1,121 +0,0 @@
1
- import React, { useState, useEffect } from "react";
2
- import classnames from "classnames";
3
- import useMedia from "use-media";
4
- import Avatar from "../avatar/avatar";
5
- import { useTheme } from "../../theme/theme";
6
- import { MenuList, MenuListItem, MenuListItemText } from "../menu";
7
- import NavigationUserMenuItems from "./navigation-user-menu-items";
8
- function NavigationUserMenu({ user, items, isOpen, onChangeOpen, }) {
9
- const theme = useTheme();
10
- // Allow users with pointing devices to open/close the menu by hovering in/out
11
- const [isHovered, bind] = useHover();
12
- useEffect(() => {
13
- onChangeOpen(isHovered);
14
- }, [onChangeOpen, isHovered]);
15
- return (<div className={classnames("menu-anchor", {
16
- compact: useMedia("screen and (max-width: 425px)"),
17
- })} {...bind()}>
18
- <div className={classnames("menu-trigger", { open: isOpen })}>
19
- <Avatar name={user.name} src={user.avatar ? user.avatar.src : undefined} onClick={() => onChangeOpen(!isOpen)}/>
20
- </div>
21
- {items && isOpen && (<div className="user-menu">
22
- <MenuList>
23
- <MenuListItem>
24
- <MenuListItemText primaryText={<strong>Hello {user.name}!</strong>}/>
25
- </MenuListItem>
26
- <NavigationUserMenuItems items={items}/>
27
- </MenuList>
28
- </div>)}
29
- <style jsx>{`
30
- .menu-trigger {
31
- cursor: pointer;
32
- width: 3rem;
33
- height: 3rem;
34
- display: flex;
35
- justify-content: center;
36
- align-items: center;
37
- border-radius: 0.25rem;
38
- }
39
-
40
- .open {
41
- background-color: #efefef;
42
- }
43
-
44
- .menu-anchor {
45
- position: relative;
46
- overflow: visible;
47
- }
48
-
49
- .menu-anchor.compact {
50
- position: initial;
51
- }
52
-
53
- .user-menu {
54
- position: absolute;
55
- z-index: 1;
56
- top: 100%;
57
- right: 0;
58
- background-color: white;
59
- border-radius: 0.25rem;
60
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12),
61
- 0 1px 4px rgba(0, 0, 0, 0.24);
62
- overflow-x: scroll;
63
- max-height: calc(100vh - 64px);
64
- }
65
-
66
- /* arrow */
67
- .user-menu::before {
68
- display: block;
69
- content: "";
70
- width: 0;
71
- height: 0;
72
- border-left: 8px solid transparent;
73
- border-right: 8px solid transparent;
74
- border-bottom: 8px solid white;
75
- position: absolute;
76
- top: -8px;
77
- right: calc((3rem / 2) - 8px);
78
- }
79
-
80
- .compact .user-menu {
81
- left: 8px;
82
- right: 8px;
83
- top: 3.5rem;
84
- }
85
-
86
- .compact .user-menu::before {
87
- right: calc((3rem / 2) - 8px + 4.5rem);
88
- }
89
-
90
- .user-menu :global(.mdc-list-item__graphic) {
91
- margin-right: 1rem;
92
- }
93
-
94
- .user-menu :global(.mdc-list-item:not(:last-of-type)) {
95
- border-bottom: 1px solid #e0e0e0;
96
- }
97
- `}</style>
98
- <style jsx>{`
99
- .user-menu :global(.mdc-list) {
100
- font-family: ${theme.typography.fontFamily.brand};
101
- }
102
-
103
- strong {
104
- color: ${theme.color.foreground.primary};
105
- }
106
- `}</style>
107
- </div>);
108
- }
109
- export default NavigationUserMenu;
110
- function useHover() {
111
- const [isHovered, setIsHovered] = useState();
112
- const bind = () => ({
113
- onMouseOver: () => {
114
- setIsHovered(true);
115
- },
116
- onMouseLeave: () => {
117
- setIsHovered(false);
118
- },
119
- });
120
- return [isHovered, bind];
121
- }