@rango-dev/widget-embedded 0.20.1-next.20 → 0.20.1-next.21

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 (84) hide show
  1. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +161 -1
  2. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  3. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +0 -1
  4. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  5. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  6. package/dist/components/Layout/Layout.d.ts +2 -3
  7. package/dist/components/Layout/Layout.d.ts.map +1 -1
  8. package/dist/components/Layout/Layout.helpers.d.ts +2 -0
  9. package/dist/components/Layout/Layout.helpers.d.ts.map +1 -0
  10. package/dist/components/Layout/Layout.styles.d.ts +2 -4
  11. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  12. package/dist/components/Layout/Layout.types.d.ts +6 -3
  13. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  14. package/dist/components/Layout/PageContainer.d.ts +166 -0
  15. package/dist/components/Layout/PageContainer.d.ts.map +1 -0
  16. package/dist/components/Layout/ScrollableArea.d.ts +164 -0
  17. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -0
  18. package/dist/components/Layout/index.d.ts +2 -0
  19. package/dist/components/Layout/index.d.ts.map +1 -1
  20. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  21. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +0 -161
  22. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  23. package/dist/components/SettingsContainer/index.d.ts +1 -1
  24. package/dist/components/SettingsContainer/index.d.ts.map +1 -1
  25. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  26. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  27. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +161 -1
  28. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  29. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  30. package/dist/containers/App/App.styles.d.ts.map +1 -1
  31. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +1 -1
  32. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  33. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -324
  34. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  35. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -7
  36. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  37. package/dist/index.js +2 -2
  38. package/dist/index.js.map +4 -4
  39. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  40. package/dist/pages/HistoryPage.d.ts.map +1 -1
  41. package/dist/pages/Home.d.ts.map +1 -1
  42. package/dist/pages/LanguagePage.d.ts.map +1 -1
  43. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  44. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  45. package/dist/pages/SettingsPage.d.ts.map +1 -1
  46. package/dist/pages/ThemePage.d.ts.map +1 -1
  47. package/dist/pages/WalletsPage.d.ts.map +1 -1
  48. package/dist/utils/ui.d.ts +2 -0
  49. package/dist/utils/ui.d.ts.map +1 -1
  50. package/package.json +2 -2
  51. package/src/components/BlockchainList/BlockchainList.styles.ts +4 -3
  52. package/src/components/BlockchainList/BlockchainList.tsx +1 -1
  53. package/src/components/HeaderButtons/HeaderButtons.types.ts +0 -1
  54. package/src/components/HeaderButtons/HomeButtons.tsx +1 -2
  55. package/src/components/Layout/Layout.helpers.ts +16 -0
  56. package/src/components/Layout/Layout.styles.ts +17 -31
  57. package/src/components/Layout/Layout.tsx +23 -21
  58. package/src/components/Layout/Layout.types.ts +9 -8
  59. package/src/components/Layout/PageContainer.tsx +24 -0
  60. package/src/components/Layout/ScrollableArea.tsx +11 -0
  61. package/src/components/Layout/index.ts +2 -0
  62. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +0 -1
  63. package/src/components/SettingsContainer/SettingsContainer.style.ts +0 -5
  64. package/src/components/SettingsContainer/index.ts +0 -1
  65. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -1
  66. package/src/components/SwapDetails/SwapDetails.styles.ts +5 -6
  67. package/src/components/SwapDetails/SwapDetails.tsx +3 -5
  68. package/src/components/TokenList/TokenList.styles.ts +2 -0
  69. package/src/components/TokenList/TokenList.tsx +1 -1
  70. package/src/containers/App/App.styles.ts +2 -0
  71. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  72. package/src/containers/QuoteInfo/QuoteInfo.tsx +30 -77
  73. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -7
  74. package/src/pages/ConfirmSwapPage.tsx +49 -42
  75. package/src/pages/HistoryPage.tsx +4 -11
  76. package/src/pages/Home.tsx +35 -37
  77. package/src/pages/LanguagePage.tsx +3 -4
  78. package/src/pages/LiquiditySourcePage.tsx +3 -4
  79. package/src/pages/SelectBlockchainPage.tsx +38 -38
  80. package/src/pages/SelectSwapItemsPage.tsx +40 -38
  81. package/src/pages/SettingsPage.tsx +3 -4
  82. package/src/pages/ThemePage.tsx +3 -4
  83. package/src/pages/WalletsPage.tsx +12 -13
  84. package/src/utils/ui.ts +20 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AA0D5E,wBAAgB,eAAe,sBA6S9B"}
1
+ {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmD5E,wBAAgB,eAAe,sBA2T9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"HistoryPage.d.ts","sourceRoot":"","sources":["../../src/pages/HistoryPage.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmB,MAAM,OAAO,CAAC;AA0CxC,wBAAgB,WAAW,sBAoE1B"}
1
+ {"version":3,"file":"HistoryPage.d.ts","sourceRoot":"","sources":["../../src/pages/HistoryPage.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAkCxC,wBAAgB,WAAW,sBAqE1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA+C3D,wBAAgB,IAAI,sBA6OnB"}
1
+ {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAuCnD,wBAAgB,IAAI,sBAmPnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"LanguagePage.d.ts","sourceRoot":"","sources":["../../src/pages/LanguagePage.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,wBAAgB,YAAY,sBAwC3B"}
1
+ {"version":3,"file":"LanguagePage.d.ts","sourceRoot":"","sources":["../../src/pages/LanguagePage.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,wBAAgB,YAAY,sBAwC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAexC,UAAU,SAAS;IACjB,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,qBAwH5D"}
1
+ {"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,UAAU,SAAS;IACjB,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,qBAwH5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectSwapItemsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectSwapItemsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,UAAU,SAAS;IACjB,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC;CAChC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,qBAmGnD"}
1
+ {"version":3,"file":"SelectSwapItemsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectSwapItemsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,UAAU,SAAS;IACjB,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC;CAChC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,qBAqGnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,wBAAgB,YAAY,sBA4K3B"}
1
+ {"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,YAAY,sBA4K3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemePage.d.ts","sourceRoot":"","sources":["../../src/pages/ThemePage.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,wBAAgB,SAAS,sBAiExB"}
1
+ {"version":3,"file":"ThemePage.d.ts","sourceRoot":"","sources":["../../src/pages/ThemePage.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,wBAAgB,SAAS,sBAiExB"}
@@ -1 +1 @@
1
- {"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAsBlD,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,sBAmE1B"}
1
+ {"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAsBxC,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,sBAkE1B"}
@@ -1,5 +1,6 @@
1
1
  import type { WidgetTheme } from '../types';
2
2
  import type { createTheme } from '@rango-dev/ui';
3
+ import type React from 'react';
3
4
  interface CustomizedThemeValues {
4
5
  id: string;
5
6
  tokens: Parameters<typeof createTheme>[0];
@@ -9,5 +10,6 @@ interface CustomizedTheme {
9
10
  dark: undefined | CustomizedThemeValues;
10
11
  }
11
12
  export declare function customizedThemeTokens(colors: WidgetTheme['colors']): CustomizedTheme;
13
+ export declare function joinList(list: React.JSX.Element[], divider: React.JSX.Element): React.JSX.Element[];
12
14
  export {};
13
15
  //# sourceMappingURL=ui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/utils/ui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAYjD,UAAU,qBAAqB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,SAAS,GAAG,qBAAqB,CAAC;IACzC,IAAI,EAAE,SAAS,GAAG,qBAAqB,CAAC;CACzC;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,GAC5B,eAAe,CA6CjB"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/utils/ui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,UAAU,qBAAqB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,SAAS,GAAG,qBAAqB,CAAC;IACzC,IAAI,EAAE,SAAS,GAAG,qBAAqB,CAAC;CACzC;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,GAC5B,eAAe,CA6CjB;AAED,wBAAgB,QAAQ,CACtB,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,EACzB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,uBAe3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.20.1-next.20",
3
+ "version": "0.20.1-next.21",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -25,7 +25,7 @@
25
25
  "@rango-dev/queue-manager-core": "^0.25.0",
26
26
  "@rango-dev/queue-manager-rango-preset": "^0.25.1-next.2",
27
27
  "@rango-dev/queue-manager-react": "^0.24.0",
28
- "@rango-dev/ui": "^0.26.1-next.11",
28
+ "@rango-dev/ui": "^0.26.1-next.12",
29
29
  "@rango-dev/wallets-react": "^0.11.1-next.1",
30
30
  "@rango-dev/wallets-shared": "^0.25.1-next.1",
31
31
  "bignumber.js": "^9.1.1",
@@ -1,17 +1,18 @@
1
1
  import { ImageContainer, styled } from '@rango-dev/ui';
2
2
 
3
+ import { ScrollableArea } from '../Layout';
4
+
3
5
  export const Container = styled('div', {
4
6
  display: 'flex',
5
7
  flexDirection: 'column',
6
8
  overflow: 'hidden',
7
9
  });
8
10
 
9
- export const List = styled('ul', {
11
+ export const List = styled(ScrollableArea, {
10
12
  padding: 0,
11
13
  margin: 0,
12
14
  listStyle: 'none',
13
- overflowY: 'auto',
14
- paddingRight: '$5',
15
+
15
16
  [`& ${ImageContainer}`]: {
16
17
  borderRadius: '$xm',
17
18
  overflow: 'hidden',
@@ -41,7 +41,7 @@ export function BlockchainList(props: PropTypes) {
41
41
  );
42
42
  }
43
43
  return (
44
- <List key={`${blockchainCategory}-${searchedFor}`}>
44
+ <List as="ul" key={`${blockchainCategory}-${searchedFor}`}>
45
45
  {blockchains.map((item) => (
46
46
  <ListItemButton
47
47
  key={`${item.name}-${item.chainId}`}
@@ -4,7 +4,6 @@ export interface PropTypes {
4
4
  container?: HTMLElement;
5
5
  }
6
6
  export interface HomeButtonsPropTypes {
7
- layoutRef: HTMLDivElement | null;
8
7
  onClickRefresh?: () => void;
9
8
  onClickHistory?: () => void;
10
9
  onClickSettings?: () => void;
@@ -20,7 +20,7 @@ import { RefreshButton } from './RefreshButton';
20
20
  import { UnreadNotificationsBadge } from './UnreadNotificationsBadge';
21
21
 
22
22
  export function HomeButtons(props: HomeButtonsPropTypes) {
23
- const { layoutRef, onClickRefresh, onClickHistory, onClickSettings } = props;
23
+ const { onClickRefresh, onClickHistory, onClickSettings } = props;
24
24
 
25
25
  const {
26
26
  config: { features },
@@ -40,7 +40,6 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
40
40
  {!isNotificationsHidden && (
41
41
  <Popover
42
42
  align="center"
43
- collisionBoundary={layoutRef}
44
43
  collisionPadding={{ right: 20, left: 20 }}
45
44
  container={getContainer()}
46
45
  content={<NotificationContent />}>
@@ -0,0 +1,16 @@
1
+ import { getContainer } from '../../utils/common';
2
+
3
+ export function onScrollContentAttachStatusToContainer(e: Event) {
4
+ const contentElement = e.target as HTMLElement | null;
5
+
6
+ if (contentElement) {
7
+ const fromTop = contentElement.scrollTop;
8
+ const container = getContainer();
9
+
10
+ if (fromTop > 1) {
11
+ container.classList.add('rng-scrolled');
12
+ } else {
13
+ container.classList.remove('rng-scrolled');
14
+ }
15
+ }
16
+ }
@@ -1,54 +1,40 @@
1
- import { darkTheme, styled } from '@rango-dev/ui';
1
+ import { styled } from '@rango-dev/ui';
2
2
 
3
+ const WIDGET_HEIGHT = '700px';
3
4
  export const Container = styled('div', {
4
5
  position: 'relative',
5
6
  display: 'flex',
6
7
  flexDirection: 'column',
7
8
  borderRadius: '$primary',
8
- overflow: 'hidden !important',
9
- boxShadow: '15px 15px 15px 0px rgba(0, 0, 0, 0.05)',
10
- width: '100vw',
9
+ width: '100vh',
11
10
  minWidth: '300px',
12
11
  maxWidth: '390px',
13
- maxHeight: '700px',
14
- textAlign: 'left',
15
- $$color: '$colors$neutral100',
16
- [`.${darkTheme} &`]: {
17
- $$color: '$colors$neutral300',
18
- },
19
- backgroundColor: '$$color',
12
+ boxShadow: '15px 15px 15px 0px rgba(0, 0, 0, 0.05)',
13
+ overflow: 'hidden',
14
+ backgroundColor: '$background',
15
+
20
16
  variants: {
21
- fixedHeight: {
22
- true: {
23
- height: '100vh',
17
+ height: {
18
+ auto: {
19
+ height: 'auto',
20
+ maxHeight: WIDGET_HEIGHT,
24
21
  },
25
- false: {
26
- height: 'auto !important',
22
+ fixed: {
23
+ height: WIDGET_HEIGHT,
27
24
  },
28
25
  },
29
26
  },
30
27
  });
31
28
 
32
29
  export const Content = styled('div', {
33
- borderTopLeftRadius: '20px',
34
- borderTopRightRadius: '20px',
30
+ position: 'relative',
31
+ overflow: 'hidden',
32
+ flexGrow: 1,
35
33
  display: 'flex',
36
34
  flexDirection: 'column',
37
- flex: 1,
38
- padding: '$20 $20 $10 $20',
39
- backgroundColor: '$background',
40
- position: 'relative',
35
+ padding: 0,
41
36
  overflowY: 'auto',
42
- overflowX: 'hidden',
43
- variants: {
44
- noPadding: {
45
- true: {
46
- padding: '0',
47
- },
48
- },
49
- },
50
37
  });
51
-
52
38
  export const Footer = styled('div', {
53
39
  backgroundColor: '$background',
54
40
  '& .footer__content': {
@@ -1,8 +1,8 @@
1
- import type { PropTypes, Ref } from './Layout.types';
1
+ import type { PropTypes } from './Layout.types';
2
2
  import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import { BottomLogo, Divider, Header } from '@rango-dev/ui';
5
- import React from 'react';
5
+ import React, { useEffect, useRef } from 'react';
6
6
 
7
7
  import { RANGO_SWAP_BOX_ID } from '../../constants';
8
8
  import { useNavigateBack } from '../../hooks/useNavigateBack';
@@ -14,17 +14,11 @@ import { getContainer } from '../../utils/common';
14
14
  import { isFeatureHidden } from '../../utils/settings';
15
15
  import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
16
16
 
17
+ import { onScrollContentAttachStatusToContainer } from './Layout.helpers';
17
18
  import { Container, Content, Footer } from './Layout.styles';
18
19
 
19
- function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
20
- const {
21
- children,
22
- header,
23
- footer,
24
- noPadding,
25
- hasLogo = true,
26
- fixedHeight = true,
27
- } = props;
20
+ function Layout(props: PropsWithChildren<PropTypes>) {
21
+ const { children, header, footer, hasLogo = true, height = 'fixed' } = props;
28
22
  const connectedWallets = useWalletsStore.use.connectedWallets();
29
23
  const {
30
24
  config: { features, theme },
@@ -49,12 +43,24 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
49
43
  const showBackButton =
50
44
  typeof header.hasBackButton === 'undefined' || header.hasBackButton;
51
45
 
46
+ const scrollViewRef = useRef<HTMLDivElement>(null);
47
+
48
+ useEffect(() => {
49
+ scrollViewRef.current?.addEventListener(
50
+ 'scroll',
51
+ onScrollContentAttachStatusToContainer
52
+ );
53
+
54
+ return () => {
55
+ scrollViewRef.current?.removeEventListener(
56
+ 'scroll',
57
+ onScrollContentAttachStatusToContainer
58
+ );
59
+ };
60
+ }, []);
61
+
52
62
  return (
53
- <Container
54
- ref={ref}
55
- fixedHeight={fixedHeight}
56
- id={RANGO_SWAP_BOX_ID}
57
- className={activeTheme()}>
63
+ <Container height={height} id={RANGO_SWAP_BOX_ID} className={activeTheme()}>
58
64
  <Header
59
65
  prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
60
66
  title={header.title}
@@ -72,7 +78,7 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
72
78
  </>
73
79
  }
74
80
  />
75
- <Content noPadding={noPadding}>{children}</Content>
81
+ <Content ref={scrollViewRef}>{children}</Content>
76
82
  {(hasLogo || footer) && (
77
83
  <Footer>
78
84
  <div className="footer__content">{footer}</div>
@@ -87,8 +93,4 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
87
93
  </Container>
88
94
  );
89
95
  }
90
-
91
- const Layout = React.forwardRef(LayoutComponent);
92
- Layout.displayName = 'Layout';
93
-
94
96
  export { Layout };
@@ -1,3 +1,11 @@
1
+ import type { Container } from './Layout.styles';
2
+ import type * as Stitches from '@stitches/react';
3
+
4
+ type ContainerProps = Stitches.VariantProps<typeof Container>;
5
+ type ContainerHeightProp = NonNullable<
6
+ Exclude<ContainerProps['height'], object>
7
+ >;
8
+
1
9
  export interface PropTypes {
2
10
  header: {
3
11
  title: string;
@@ -9,12 +17,5 @@ export interface PropTypes {
9
17
  };
10
18
  hasLogo?: boolean;
11
19
  footer?: React.ReactNode;
12
- noPadding?: boolean;
13
- fixedHeight?: boolean;
20
+ height?: ContainerHeightProp;
14
21
  }
15
-
16
- export type Ref =
17
- | ((instance: HTMLDivElement | null) => void)
18
- | React.RefObject<HTMLDivElement>
19
- | null
20
- | undefined;
@@ -0,0 +1,24 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ const PageContainer = styled('div', {
4
+ display: 'flex',
5
+ flexDirection: 'column',
6
+ padding: '20px 20px 10px',
7
+ flexGrow: 1,
8
+
9
+ variants: {
10
+ view: {
11
+ true: {
12
+ flexGrow: 1,
13
+ overflow: 'hidden',
14
+ },
15
+ },
16
+ compact: {
17
+ true: {
18
+ padding: 0,
19
+ },
20
+ },
21
+ },
22
+ });
23
+
24
+ export { PageContainer };
@@ -0,0 +1,11 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ const CONTENT_PADDING = '$20 $20 $10 $20';
4
+
5
+ const ScrollableArea = styled('div', {
6
+ padding: CONTENT_PADDING,
7
+ overflowY: 'auto',
8
+ flexGrow: 1,
9
+ });
10
+
11
+ export { ScrollableArea, CONTENT_PADDING };
@@ -1 +1,3 @@
1
1
  export { Layout } from './Layout';
2
+ export { ScrollableArea, CONTENT_PADDING } from './ScrollableArea';
3
+ export { PageContainer } from './PageContainer';
@@ -2,7 +2,6 @@ import { darkTheme, styled } from '@rango-dev/ui';
2
2
 
3
3
  export const Alerts = styled('div', {
4
4
  width: '100%',
5
- paddingTop: '$10',
6
5
  });
7
6
 
8
7
  export const Flex = styled('div', {
@@ -1,10 +1,5 @@
1
1
  import { styled } from '@rango-dev/ui';
2
2
 
3
- export const SettingsContainer = styled('div', {
4
- height: '100%',
5
- overflow: 'hidden',
6
- });
7
-
8
3
  export const LiquiditySourceList = styled('ul', {
9
4
  padding: '$15 $5 0',
10
5
  margin: 0,
@@ -1,5 +1,4 @@
1
1
  export {
2
- SettingsContainer,
3
2
  LiquiditySourceList,
4
3
  LiquiditySourceSuffix,
5
4
  NotFoundContainer,
@@ -21,7 +21,6 @@ export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
21
21
  const { requestId, showSkeleton } = props;
22
22
  return (
23
23
  <Layout
24
- noPadding
25
24
  header={{
26
25
  title: i18n.t('Swap and Bridge'),
27
26
  suffix: <SuffixContainer />,
@@ -1,23 +1,22 @@
1
1
  import { css, darkTheme, styled } from '@rango-dev/ui';
2
2
 
3
+ import { ScrollableArea } from '../Layout';
4
+
3
5
  export const Container = styled('div', {
4
6
  display: 'flex',
5
- width: '100%',
6
7
  flexDirection: 'column',
7
- alignItems: 'center',
8
- height: '0',
9
8
  flexGrow: 1,
9
+ overflow: 'hidden',
10
10
  });
11
11
 
12
12
  export const HeaderDetails = styled('div', {
13
13
  width: '100%',
14
14
  });
15
15
 
16
- export const StepsList = styled('div', {
16
+ export const StepsList = styled(ScrollableArea, {
17
17
  padding: '$0 $20 $20 $20',
18
- width: '100%',
19
- overflow: 'auto',
20
18
  });
19
+
21
20
  export const Alerts = styled('div', {
22
21
  display: 'flex',
23
22
  flexDirection: 'column',
@@ -54,7 +54,7 @@ import {
54
54
  import { getSwapDate } from '../../utils/time';
55
55
  import { getConciseAddress } from '../../utils/wallets';
56
56
  import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
57
- import { Layout } from '../Layout';
57
+ import { Layout, PageContainer } from '../Layout';
58
58
  import { QuoteSummary } from '../Quote';
59
59
  import {
60
60
  SwapDetailsCompleteModal,
@@ -63,7 +63,6 @@ import {
63
63
 
64
64
  import { getSteps, getStepState, RESET_INTERVAL } from './SwapDetails.helpers';
65
65
  import {
66
- Container,
67
66
  HeaderDetails,
68
67
  outputStyles,
69
68
  requestIdStyles,
@@ -241,7 +240,6 @@ export function SwapDetails(props: SwapDetailsProps) {
241
240
 
242
241
  return (
243
242
  <Layout
244
- noPadding
245
243
  header={{
246
244
  title: i18n.t('Swap and Bridge'),
247
245
  onCancel:
@@ -279,7 +277,7 @@ export function SwapDetails(props: SwapDetailsProps) {
279
277
  </Button>
280
278
  )
281
279
  }>
282
- <Container>
280
+ <PageContainer compact view>
283
281
  <HeaderDetails>
284
282
  <div className={rowStyles()}>
285
283
  <Typography variant="label" size="large" color="neutral700">
@@ -400,7 +398,7 @@ export function SwapDetails(props: SwapDetailsProps) {
400
398
  );
401
399
  })}
402
400
  </StepsList>
403
- </Container>
401
+ </PageContainer>
404
402
 
405
403
  <SwapDetailsModal
406
404
  state={modalState}
@@ -51,6 +51,7 @@ export const Container = styled('div', {
51
51
  display: 'flex',
52
52
  flexDirection: 'column',
53
53
  flexGrow: 1,
54
+ overflow: 'hidden',
54
55
  });
55
56
 
56
57
  export const Title = styled('div', {
@@ -68,6 +69,7 @@ export const List = styled('ul', {
68
69
  padding: 0,
69
70
  margin: 0,
70
71
  listStyle: 'none',
72
+
71
73
  '& li': {
72
74
  alignItems: 'none',
73
75
 
@@ -278,7 +278,7 @@ export function TokenList(props: PropTypes) {
278
278
  </Typography>
279
279
  <Divider size={4} />
280
280
  {fetchStatus === 'loading' && <LoadingTokenList size={PAGE_SIZE} />}
281
- {fetchStatus === 'success' && <List>{renderList()}</List>}
281
+ {fetchStatus === 'success' && <List as="ul">{renderList()}</List>}
282
282
  </Container>
283
283
  );
284
284
  }
@@ -6,6 +6,8 @@ export const MainContainer = styled('div', {
6
6
  alignItems: 'center',
7
7
  fontFamily: '$widget',
8
8
  boxSizing: 'border-box',
9
+ textAlign: 'left',
10
+
9
11
  '& *, *::before, *::after': {
10
12
  boxSizing: 'inherit',
11
13
  },
@@ -1,26 +1,11 @@
1
1
  import { styled } from '@rango-dev/ui';
2
2
 
3
- export const PositionTopAlerts = styled('div', {
4
- paddingBottom: '$10',
5
- });
6
-
7
3
  export const QuoteContainer = styled('div', {
8
4
  width: '100%',
9
5
  '& .position-top__skeleton': {
10
6
  paddingTop: '$10',
11
7
  },
12
8
  });
13
-
14
- export const SkeletonContainer = styled('div', {
15
- variants: {
16
- paddingTop: {
17
- true: {
18
- paddingTop: '$10',
19
- },
20
- },
21
- },
22
- });
23
-
24
9
  export const FooterStepAlarm = styled('div', {
25
10
  paddingBottom: '$15',
26
11
  });