Skip to content

Commit

Permalink
boxes instead of frames
Browse files Browse the repository at this point in the history
  • Loading branch information
nialexsan committed Feb 14, 2024
1 parent 20632ad commit a03ca39
Show file tree
Hide file tree
Showing 19 changed files with 878 additions and 95 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"parser": "babel-eslint",
"extends": [
"next",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:react-hooks/recommended"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
node-version: [15.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:

strategy:
matrix:
node-version: [15.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v2
Expand Down
11 changes: 10 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ module.exports = function (api) {
const removeDataTestAttributes =
api.env("production") && !process.env.PRESERVE_DATA_TEST_ATTRIBUTES

const presets = ["next/babel"]
const presets = [
"next/babel",
{
"preset-react": {
importSource: "theme-ui", // or '@theme-ui/core'
runtime: "automatic",
throwIfNamespace: false,
},
},
]
const plugins = removeDataTestAttributes
? [["react-remove-properties", {properties: ["data-test"]}]]
: []
Expand Down
1 change: 0 additions & 1 deletion components/CreateAccountForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsxImportSource theme-ui */
import CreateAccountFields from "components/CreateAccountFields"
import CreateAccountSubmitted from "components/CreateAccountSubmitted"
import FormContainer from "components/FormContainer"
Expand Down
9 changes: 4 additions & 5 deletions components/CreateAccountSubmitted.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsxImportSource theme-ui */
import * as fcl from "@onflow/fcl"
import copy from "clipboard-copy"
import Button from "components/Button"
Expand Down Expand Up @@ -77,11 +76,11 @@ export default function CreateAccountSubmitted({address}: {address: string}) {
<Flex
sx={{alignItems: "center", justifyContent: "space-between"}}
>
<div sx={styles.walletAmount}>
<Box sx={styles.walletAmount}>
{`${parseFloat(
publicConfig.tokenAmountFlow
).toLocaleString()} FLOW tokens`}
</div>
</Box>
<Link
href={`https://flow-view-source.com/testnet/account/${address}`}
target="_blank"
Expand Down Expand Up @@ -115,7 +114,7 @@ export default function CreateAccountSubmitted({address}: {address: string}) {
</Box>
<Themed.hr />
<Box mb={5}>
<div sx={styles.infoBox}>
<Box sx={styles.infoBox}>
<Themed.h3 sx={{my: 0}}>What can I build on Flow?</Themed.h3>
<Themed.p>
Flow is designed for high-throughput, low-latency consumer
Expand All @@ -132,7 +131,7 @@ export default function CreateAccountSubmitted({address}: {address: string}) {
>
Join the Flow alpha community
</Button>
</div>
</Box>
</Box>
</>
)
Expand Down
6 changes: 2 additions & 4 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @jsxImportSource theme-ui */

import {TANOOKI_LABS_URL} from "lib/constants"
import {Box, Container, Flex, Link, ThemeUICSSObject} from "theme-ui"

Expand Down Expand Up @@ -31,7 +29,7 @@ export default function Footer() {
}

return (
<div sx={styles.footer}>
<Box sx={styles.footer}>
<Container>
<Flex sx={styles.innerContainer}>
<Flex mr={[0, "auto"]} mb={[2, 0]}>
Expand Down Expand Up @@ -61,6 +59,6 @@ export default function Footer() {
</Flex>
</Flex>
</Container>
</div>
</Box>
)
}
10 changes: 4 additions & 6 deletions components/FormContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/** @jsxImportSource theme-ui */

import NetworkLinks from "components/NetworkLinks"
import React from "react"
import {ThemeUICSSObject} from "theme-ui"
import {Box, ThemeUICSSObject} from "theme-ui"

export default function FormContainer({children}: {children: React.ReactNode}) {
const styles: Record<string, ThemeUICSSObject> = {
Expand All @@ -22,9 +20,9 @@ export default function FormContainer({children}: {children: React.ReactNode}) {
},
}
return (
<div sx={styles.container}>
<Box sx={styles.container}>
<NetworkLinks />
<div sx={styles.children}>{children}</div>
</div>
<Box sx={styles.children}>{children}</Box>
</Box>
)
}
4 changes: 2 additions & 2 deletions components/FundAccountSubmitted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export default function FundAccountSubmitted({
<Flex
sx={{alignItems: "center", justifyContent: "space-between"}}
>
<div sx={styles.walletAmount}>
<Box sx={styles.walletAmount}>
{`${parseFloat(result.amount).toLocaleString()} ${
result.token
} tokens`}
</div>
</Box>
<Link
href={`https://flow-view-source.com/testnet/account/${result.address}`}
target="_blank"
Expand Down
4 changes: 2 additions & 2 deletions components/Label.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsxImportSource theme-ui */
import {Label as ThemeUILabel, LabelProps} from "theme-ui"
import {Label as ThemeUILabel, LabelProps, Box} from "theme-ui"

type Props = {
required?: boolean
Expand All @@ -17,7 +17,7 @@ const Label = ({required = false, children, ...props}: Props) => {
return (
<ThemeUILabel {...props}>
{children}
{required && <div sx={styles.required}>*</div>}
{required && <Box sx={styles.required}>*</Box>}
</ThemeUILabel>
)
}
Expand Down
7 changes: 3 additions & 4 deletions components/LoadingFeedback.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @jsxImportSource theme-ui */
import {ThemeUICSSObject} from "theme-ui"
import {Box, ThemeUICSSObject} from "theme-ui"

const styles: Record<string, ThemeUICSSObject> = {
loading: {
Expand All @@ -21,10 +20,10 @@ export default function LoadingFeedback({
children?: React.ReactNode
}) {
return (
<div sx={styles.loading}>
<Box sx={styles.loading}>
<img src="loading.svg" />

Check warning on line 24 in components/LoadingFeedback.tsx

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

img elements must have an alt prop, either with meaningful text, or an empty string for decorative images

Check warning on line 24 in components/LoadingFeedback.tsx

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
<br />
{children}
</div>
</Box>
)
}
11 changes: 5 additions & 6 deletions components/NetworkLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/** @jsxImportSource theme-ui */

import TabNav, {TabNavLink} from "components/TabNav"
import {TEST_NET, SANDBOX_NET} from "lib/constants"
import {NETWORK_DISPLAY_NAME} from "lib/network"
import publicConfig from "lib/publicConfig"
import {Box, Image} from "theme-ui"

export default function NetworkLinks() {
const styles = {
Expand All @@ -23,13 +22,13 @@ export default function NetworkLinks() {
}

return (
<div sx={styles.container}>
<Box sx={styles.container}>
<TabNav>
<TabNavLink
href={publicConfig.testNetUrl}
active={publicConfig.network === TEST_NET}
>
<img
<Image
src={
publicConfig.network === TEST_NET
? "testnet-faucet-icon.svg"
Expand All @@ -44,7 +43,7 @@ export default function NetworkLinks() {
href={publicConfig.sandboxNetUrl}
active={publicConfig.network === SANDBOX_NET}
>
<img
<Image
src={
publicConfig.network === SANDBOX_NET
? "sandboxnet-faucet-icon.svg"
Expand All @@ -56,6 +55,6 @@ export default function NetworkLinks() {
Sandboxnet
</TabNavLink>
</TabNav>
</div>
</Box>
)
}
18 changes: 9 additions & 9 deletions components/SidebarAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import useAccordionOption from "hooks/useAccordionOption"
import {ACCOUNTS_KEYS_DOCS_URL, H_CAPTCHA_URL} from "lib/constants"
import {useMixpanel} from "lib/mixpanel"
import {useState} from "react"
import {Link, ThemeUICSSObject} from "theme-ui"
import {Box, Button, Link, ThemeUICSSObject} from "theme-ui"
import {Themed} from "@theme-ui/mdx"
import publicConfig from "../lib/publicConfig"

Expand Down Expand Up @@ -126,8 +126,8 @@ const AccordionOption = ({
},
}
return (
<div sx={styles.container}>
<button
<Box sx={styles.container}>
<Button
{...buttonProps}
sx={styles.button}
onClick={() => {
Expand All @@ -140,13 +140,13 @@ const AccordionOption = ({
>
{data.title}
<img src={`caret-${isOpen ? "up" : "down"}.svg`} />

Check warning on line 142 in components/SidebarAccordion.tsx

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

img elements must have an alt prop, either with meaningful text, or an empty string for decorative images

Check warning on line 142 in components/SidebarAccordion.tsx

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
</button>
</Button>
{isOpen && (
<div sx={styles.content} {...contentProps}>
<Box sx={styles.content} {...contentProps}>
{typeof data.content === "function" ? data.content({}) : data.content}
</div>
</Box>
)}
</div>
</Box>
)
}

Expand All @@ -157,7 +157,7 @@ export default function SidebarAccordion() {
}

return (
<div sx={style}>
<Box sx={style}>
{accordionData.map((data, index) => (
<AccordionOption
data={data}
Expand All @@ -168,6 +168,6 @@ export default function SidebarAccordion() {
name="sidebarAccordion"
/>
))}
</div>
</Box>
)
}
4 changes: 2 additions & 2 deletions components/TabNav.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsxImportSource theme-ui */

import React from "react"
import {Link, ThemeUICSSObject} from "theme-ui"
import {Box, Link, ThemeUICSSObject} from "theme-ui"

export function TabNavLink({
active,
Expand Down Expand Up @@ -50,5 +50,5 @@ export default function TabNav({children}: {children: React.ReactNode}) {
paddingRight: 18,
}

return <div sx={style}>{children}</div>
return <Box sx={style}>{children}</Box>
}
6 changes: 3 additions & 3 deletions components/TokenFundingInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {TokenTypes} from "lib/constants"
import {NETWORK_DISPLAY_NAME} from "lib/network"
import {TOKEN_FUNDING_AMOUNTS} from "lib/publicConfig"
import {Text, ThemeUICSSObject} from "theme-ui"
import {Box, Text, ThemeUICSSObject} from "theme-ui"
import {Themed} from "@theme-ui/mdx"

export default function TokenFundingInfo({
Expand All @@ -27,12 +27,12 @@ export default function TokenFundingInfo({
}

return (
<div sx={style}>
<Box sx={style}>
<Themed.h4 sx={{my: 0}}>
Receive {parseFloat(TOKEN_FUNDING_AMOUNTS[token]).toLocaleString()}{" "}
{NETWORK_DISPLAY_NAME} {token} tokens
</Themed.h4>
<Text color="gray.400">{description}</Text>
</div>
</Box>
)
}
3 changes: 2 additions & 1 deletion components/inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {useTextField} from "@react-aria/textfield"
import {FieldProps} from "formik"
import {useRef} from "react"
import {
Box,
Input,
InputProps,
Select,
Expand Down Expand Up @@ -56,7 +57,7 @@ export const FieldError = ({children}: {children: React.ReactNode}) => {
},
}

return <div sx={style}>{children}</div>
return <Box sx={style}>{children}</Box>
}

export const CustomInputComponent = ({
Expand Down
9 changes: 9 additions & 0 deletions modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,12 @@ declare module "*.cdc" {

declare module "@onflow/util-encode-key"
declare module "@onflow/types"

import {} from "react"
import {ThemeUIStyleObject} from "theme-ui"

declare module "react" {
interface Attributes {
sx?: ThemeUIStyleObject
}
}
Loading

0 comments on commit a03ca39

Please sign in to comment.