@xyo-network/react-footer 2.26.37 → 2.26.40

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.
package/dist/docs.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "fileName": "index.ts",
11
11
  "line": 1,
12
12
  "character": 0,
13
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/eeec410/packages/footer/src/index.ts#L1"
13
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/0cea94b/packages/footer/src/index.ts#L1"
14
14
  }
15
15
  ]
16
16
  }
package/package.json CHANGED
@@ -79,5 +79,5 @@
79
79
  },
80
80
  "sideEffects": false,
81
81
  "types": "dist/esm/index.d.ts",
82
- "version": "2.26.37"
82
+ "version": "2.26.40"
83
83
  }
@@ -0,0 +1,47 @@
1
+ import MoreHorizIcon from '@mui/icons-material/MoreHoriz'
2
+ import { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'
3
+ import { LinkExProps } from '@xylabs/react-link'
4
+
5
+ import { FooterLink } from './Link'
6
+
7
+ export interface CopyrightProps extends FlexBoxProps {
8
+ onMore?: () => void
9
+ }
10
+
11
+ const footerLinks: LinkExProps[] = [
12
+ {
13
+ href: 'https://xylabs.com/',
14
+ title: `Copyright © ${new Date().getFullYear()} XY Labs, Inc.`,
15
+ },
16
+ {
17
+ href: 'https://xyo.network/',
18
+ title: 'XYO Foundation',
19
+ },
20
+ {
21
+ href: 'https://xylabs.com/privacy/',
22
+ title: 'Privacy',
23
+ },
24
+ {
25
+ href: 'https://xylabs.com/terms/',
26
+ title: 'Terms',
27
+ },
28
+ {
29
+ href: 'https://xylabs.com/jobs',
30
+ title: 'Careers',
31
+ },
32
+ ]
33
+
34
+ export const Copyright: React.FC<CopyrightProps> = ({ style, onMore, ...props }) => (
35
+ <FlexRow flexWrap="wrap" textTransform="uppercase" style={{ opacity: 0.6, ...style }} {...props}>
36
+ {footerLinks.map((footerLink, index) => (
37
+ <FooterLink noWrap key={index} paddingX={1} margin={0} {...footerLink}>
38
+ <small>{footerLink.title}</small>
39
+ </FooterLink>
40
+ ))}
41
+ {onMore ? (
42
+ <FlexRow style={{ cursor: 'pointer' }} paddingX={0.5} onClick={onMore}>
43
+ <MoreHorizIcon color="primary" fontSize="small" />
44
+ </FlexRow>
45
+ ) : null}
46
+ </FlexRow>
47
+ )
@@ -0,0 +1,14 @@
1
+ import { FlexBoxProps } from '@xylabs/react-flexbox'
2
+
3
+ import { FooterLink } from './Link'
4
+ import { FooterLinks } from './Links'
5
+
6
+ export const DeveloperLinks: React.FC<FlexBoxProps> = (props) => (
7
+ <FooterLinks title="Developer" {...props}>
8
+ <FooterLink href="https://xyo.network/developer">Overview</FooterLink>
9
+ <FooterLink href="https://xyo.network/developer/get-started">Get Started</FooterLink>
10
+ <FooterLink href="https://xyo.network/developer">SDKs</FooterLink>
11
+ <FooterLink href="https://github.com/xyoraclenetwork">Open Source Github</FooterLink>
12
+ <FooterLink href="https://xyo.network/docs/sdk/js">Documentation</FooterLink>
13
+ </FooterLinks>
14
+ )
@@ -0,0 +1,32 @@
1
+ import { ComponentMeta, ComponentStory } from '@storybook/react'
2
+ import { FlexCol } from '@xylabs/react-flexbox'
3
+
4
+ import { Footer } from './Footer'
5
+
6
+ const StorybookEntry = {
7
+ argTypes: {},
8
+ component: Footer,
9
+ parameters: {
10
+ docs: {
11
+ page: null,
12
+ },
13
+ },
14
+ title: 'footer/Footer',
15
+ } as ComponentMeta<typeof Footer>
16
+
17
+ const Template: ComponentStory<typeof Footer> = (args) => (
18
+ <FlexCol minHeight="80vh" justifyContent="flex-end">
19
+ <Footer {...args}></Footer>
20
+ </FlexCol>
21
+ )
22
+
23
+ const Default = Template.bind({})
24
+ Default.args = {}
25
+
26
+ const DynamicHeight = Template.bind({})
27
+ DynamicHeight.args = { dynamicHeight: true }
28
+
29
+ export { Default, DynamicHeight }
30
+
31
+ // eslint-disable-next-line import/no-default-export
32
+ export default StorybookEntry
package/src/Footer.tsx ADDED
@@ -0,0 +1,79 @@
1
+ import { Container, ContainerProps, Grid, GridProps } from '@mui/material'
2
+ import { FlexBoxProps, FlexCol, FlexRow } from '@xylabs/react-flexbox'
3
+ import { useState } from 'react'
4
+
5
+ import { Copyright } from './Copyright'
6
+ import { DeveloperLinks } from './DeveloperLinks'
7
+ import { MoreLinks } from './MoreLinks'
8
+ import { NetworkLinks } from './NetworkLinks'
9
+ import { SocialLinks } from './SocialLinks'
10
+ import { SupportLinks } from './SupportLinks'
11
+ import { XyoTokens } from './XyoTokens'
12
+
13
+ export interface FooterProps extends FlexBoxProps {
14
+ dynamicHeight?: boolean
15
+ footerHtmlElement?: boolean
16
+ container?: ContainerProps['maxWidth'] | 'none'
17
+ }
18
+
19
+ export const FooterLinkSection: React.FC<GridProps> = (props) => {
20
+ return (
21
+ <Grid container justifyContent="space-between" alignItems="flex-start" {...props}>
22
+ <Grid item xs={12} md={2}>
23
+ <SocialLinks alignItems="flex-start" />
24
+ </Grid>
25
+ <Grid item xs={6} md={2}>
26
+ <NetworkLinks alignItems="flex-start" />
27
+ </Grid>
28
+ <Grid item xs={6} md={2}>
29
+ <XyoTokens alignItems="flex-start" />
30
+ </Grid>
31
+ <Grid item xs={6} md={2}>
32
+ <DeveloperLinks alignItems="flex-start" />
33
+ </Grid>
34
+ <Grid item xs={6} md={2}>
35
+ <MoreLinks alignItems="flex-start" />
36
+ </Grid>
37
+ <Grid item xs={6} md={2}>
38
+ <SupportLinks alignItems="flex-start" />
39
+ </Grid>
40
+ </Grid>
41
+ )
42
+ }
43
+
44
+ export const Footer: React.FC<FooterProps> = ({ container, dynamicHeight = false, ...props }) => {
45
+ const [more, setMore] = useState(false)
46
+ const onMore = () => {
47
+ setMore(!more)
48
+ }
49
+ return (
50
+ <FlexCol
51
+ onMouseLeave={() => {
52
+ setMore(false)
53
+ }}
54
+ alignItems="stretch"
55
+ {...props}
56
+ >
57
+ {more || !dynamicHeight ? (
58
+ <FlexRow alignItems="flex-start">
59
+ {container && container !== 'none' ? (
60
+ <Container>
61
+ <FooterLinkSection />
62
+ </Container>
63
+ ) : (
64
+ <FooterLinkSection />
65
+ )}
66
+ </FlexRow>
67
+ ) : null}
68
+ <FlexRow>
69
+ {container && container !== 'none' ? (
70
+ <Container>
71
+ <Copyright onMore={onMore} />
72
+ </Container>
73
+ ) : (
74
+ <Copyright onMore={onMore} />
75
+ )}
76
+ </FlexRow>
77
+ </FlexCol>
78
+ )
79
+ }
package/src/Link.tsx ADDED
@@ -0,0 +1,35 @@
1
+ import { LinkEx, LinkExProps } from '@xylabs/react-link'
2
+ import { assertEx } from '@xylabs/sdk-js'
3
+
4
+ /**
5
+ * @description
6
+ * FooterLink automatically uses a local To if the link is to the current domain
7
+ * If the link is not local, it defaults to target being _blank
8
+ * In the case of 'beta' domains, it navigates correctly
9
+ */
10
+
11
+ const convertToBetaIfNeeded = (url: string | URL, currentUrl = new URL(document.location.href)) => {
12
+ const urlObj = typeof url === 'string' ? new URL(url) : url
13
+ const currentUrlObj = typeof currentUrl === 'string' ? new URL(currentUrl) : currentUrl
14
+ const currentHostnameParts = currentUrlObj.hostname.split('.')
15
+ const beta = currentHostnameParts.shift() === 'beta'
16
+ if (beta) {
17
+ const currentHostnameWithoutBeta = currentHostnameParts.join('.')
18
+ if (currentHostnameWithoutBeta === urlObj.hostname) {
19
+ urlObj.hostname = currentUrlObj.hostname
20
+ }
21
+ }
22
+ return urlObj
23
+ }
24
+
25
+ export const FooterLink: React.FC<LinkExProps> = ({ target, href, margin = 0.5, variant = 'body2', ...props }) => {
26
+ const url = new URL(assertEx(href, 'href not set'))
27
+ assertEx(url.hostname, 'Hostname is required in href')
28
+ const convertedUrl = convertToBetaIfNeeded(url)
29
+ if (document.location.hostname === convertedUrl.hostname) {
30
+ const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname
31
+ return <LinkEx margin={margin} to={to} target={target} variant={variant} {...props} />
32
+ } else {
33
+ return <LinkEx margin={margin} href={href} target={target ?? '_blank'} variant={variant} {...props} />
34
+ }
35
+ }
package/src/Links.tsx ADDED
@@ -0,0 +1,13 @@
1
+ import { Typography } from '@mui/material'
2
+ import { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'
3
+
4
+ export const FooterLinks: React.FC<FlexBoxProps> = ({ children, title, ...props }) => {
5
+ return (
6
+ <FlexCol margin={1} justifyContent="flex-start" title={title} {...props}>
7
+ <Typography margin={0.5} variant="h6" noWrap>
8
+ {title}
9
+ </Typography>
10
+ {children}
11
+ </FlexCol>
12
+ )
13
+ }
@@ -0,0 +1,12 @@
1
+ import { FlexBoxProps } from '@xylabs/react-flexbox'
2
+
3
+ import { FooterLink } from './Link'
4
+ import { FooterLinks } from './Links'
5
+
6
+ export const MoreLinks: React.FC<FlexBoxProps> = (props) => (
7
+ <FooterLinks title="More" {...props}>
8
+ <FooterLink href="https://xyo.network/partners">Partners</FooterLink>
9
+ <FooterLink href="https://xyo.network/fhr">FHR</FooterLink>
10
+ <FooterLink href="https://xyo.network/brand">Brand</FooterLink>
11
+ </FooterLinks>
12
+ )
@@ -0,0 +1,13 @@
1
+ import { FlexBoxProps } from '@xylabs/react-flexbox'
2
+
3
+ import { FooterLink } from './Link'
4
+ import { FooterLinks } from './Links'
5
+
6
+ export const NetworkLinks: React.FC<FlexBoxProps> = (props) => (
7
+ <FooterLinks title="Network" {...props}>
8
+ <FooterLink href="https://xyo.network/network">Overview</FooterLink>
9
+ <FooterLink href="https://xyo.network/network/bound-witness">Bound Witness</FooterLink>
10
+ <FooterLink href="https://xyo.network/network/proof-of-origin">Proof Of Origin</FooterLink>
11
+ <FooterLink href="https://xyo.network/papers">White Paper</FooterLink>
12
+ </FooterLinks>
13
+ )
@@ -0,0 +1,39 @@
1
+ import { Facebook, Instagram, LinkedIn, Reddit, Telegram, Twitter, YouTube } from '@mui/icons-material'
2
+ import { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'
3
+ import { FaDiscord } from 'react-icons/fa'
4
+
5
+ import { FooterLink } from './Link'
6
+ import { FooterLinks } from './Links'
7
+
8
+ export const SocialLinks: React.FC<FlexBoxProps> = (props) => {
9
+ return (
10
+ <FooterLinks title="XYO Socials" {...props}>
11
+ <FlexRow flexWrap="wrap" justifyContent="flex-start">
12
+ <FooterLink href="https://business.facebook.com/OfficialXYO/">
13
+ <Facebook />
14
+ </FooterLink>
15
+ <FooterLink href="https://twitter.com/OfficialXYO">
16
+ <Twitter />
17
+ </FooterLink>
18
+ <FooterLink href="https://www.instagram.com/officialxyo/">
19
+ <Instagram />
20
+ </FooterLink>
21
+ <FooterLink href="https://t.me/xyonetwork">
22
+ <Telegram />
23
+ </FooterLink>
24
+ <FooterLink href="https://www.reddit.com/r/XYONetwork/">
25
+ <Reddit />
26
+ </FooterLink>
27
+ <FooterLink href="https://www.youtube.com/channel/UCyZDqb9pgntVHJVt1pxXtsw">
28
+ <YouTube />
29
+ </FooterLink>
30
+ <FooterLink href="https://www.linkedin.com/company/officialxyo/">
31
+ <LinkedIn />
32
+ </FooterLink>
33
+ <FooterLink href="https://discord.com/channels/935586624392298547/935586625101103227">
34
+ <FaDiscord />
35
+ </FooterLink>
36
+ </FlexRow>
37
+ </FooterLinks>
38
+ )
39
+ }
@@ -0,0 +1,11 @@
1
+ import { FlexBoxProps } from '@xylabs/react-flexbox'
2
+
3
+ import { FooterLink } from './Link'
4
+ import { FooterLinks } from './Links'
5
+
6
+ export const SupportLinks: React.FC<FlexBoxProps> = (props) => (
7
+ <FooterLinks title="Support" {...props}>
8
+ <FooterLink href="https://support.xy.company/hc/en-us/categories/360001417734">Help Center</FooterLink>
9
+ <FooterLink href="https://support.xy.company/hc/en-us/requests/new">Contact Support</FooterLink>
10
+ </FooterLinks>
11
+ )
@@ -0,0 +1,15 @@
1
+ import { FlexBoxProps } from '@xylabs/react-flexbox'
2
+ import React from 'react'
3
+
4
+ import { FooterLink } from './Link'
5
+ import { FooterLinks } from './Links'
6
+
7
+ export const XyoTokens: React.FC<FlexBoxProps> = (props) => (
8
+ <FooterLinks title="XYO Tokens" {...props}>
9
+ <FooterLink href="https://xyo.network/token">About</FooterLink>
10
+ <FooterLink href="https://xyo.network/token/exchange">Exchanges</FooterLink>
11
+ <FooterLink href="https://xyo.network/token/price">Prices</FooterLink>
12
+ <FooterLink href="https://xyo.network/token/wallet">Wallets</FooterLink>
13
+ <FooterLink href="https://etherscan.io/address/0x55296f69f40ea6d20e478533c15a6b08b654e758">Contract</FooterLink>
14
+ </FooterLinks>
15
+ )
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ export * from './Copyright'
2
+ export * from './DeveloperLinks'
3
+ export * from './Footer'
4
+ export * from './Link'
5
+ export * from './Links'
6
+ export * from './MoreLinks'
7
+ export * from './NetworkLinks'
8
+ export * from './SocialLinks'
9
+ export * from './SupportLinks'
10
+ export * from './XyoTokens'