Skip to content

Commit bb42801

Browse files
authored
Merge branch 'dev' into feat/new-table-theme
2 parents 32e16c8 + 736cd10 commit bb42801

File tree

204 files changed

+8438
-3236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+8438
-3236
lines changed

.all-contributorsrc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10339,6 +10339,51 @@
1033910339
"contributions": [
1034010340
"content"
1034110341
]
10342+
},
10343+
{
10344+
"login": "GDdark",
10345+
"name": "DongXi Huang",
10346+
"avatar_url": "https://avatars.githubusercontent.com/u/15982894?v=4",
10347+
"profile": "https://github.com/GDdark",
10348+
"contributions": [
10349+
"content"
10350+
]
10351+
},
10352+
{
10353+
"login": "SurajAnand88",
10354+
"name": "Suraj Anand",
10355+
"avatar_url": "https://avatars.githubusercontent.com/u/120190623?v=4",
10356+
"profile": "https://surajanand88.github.io/portfolio/",
10357+
"contributions": [
10358+
"content"
10359+
]
10360+
},
10361+
{
10362+
"login": "MwitahJob",
10363+
"name": "Mwitah ",
10364+
"avatar_url": "https://avatars.githubusercontent.com/u/136892656?v=4",
10365+
"profile": "https://github.com/MwitahJob",
10366+
"contributions": [
10367+
"content"
10368+
]
10369+
},
10370+
{
10371+
"login": "TucksonDev",
10372+
"name": "Tuckson",
10373+
"avatar_url": "https://avatars.githubusercontent.com/u/105675159?v=4",
10374+
"profile": "https://github.com/TucksonDev",
10375+
"contributions": [
10376+
"content"
10377+
]
10378+
},
10379+
{
10380+
"login": "Akamig",
10381+
"name": "Akamig",
10382+
"avatar_url": "https://avatars.githubusercontent.com/u/6278999?v=4",
10383+
"profile": "https://twitter.com/_Akamig",
10384+
"contributions": [
10385+
"content"
10386+
]
1034210387
}
1034310388
],
1034410389
"contributorsPerLine": 7,

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
16171617
<td align="center" valign="top" width="14.28%"><a href="https://github.com/0xx92"><img src="https://avatars.githubusercontent.com/u/133748557?v=4?s=100" width="100px;" alt="0xx92"/><br /><sub><b>0xx92</b></sub></a><br /><a href="#content-0xx92" title="Content">🖋</a></td>
16181618
<td align="center" valign="top" width="14.28%"><a href="https://github.com/altinocoelho"><img src="https://avatars.githubusercontent.com/u/92543849?v=4?s=100" width="100px;" alt="altinocoelho"/><br /><sub><b>altinocoelho</b></sub></a><br /><a href="#content-altinocoelho" title="Content">🖋</a></td>
16191619
<td align="center" valign="top" width="14.28%"><a href="https://github.com/viac92"><img src="https://avatars.githubusercontent.com/u/64146594?v=4?s=100" width="100px;" alt="viac92"/><br /><sub><b>viac92</b></sub></a><br /><a href="#content-viac92" title="Content">🖋</a></td>
1620+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/GDdark"><img src="https://avatars.githubusercontent.com/u/15982894?v=4?s=100" width="100px;" alt="DongXi Huang"/><br /><sub><b>DongXi Huang</b></sub></a><br /><a href="#content-GDdark" title="Content">🖋</a></td>
1621+
</tr>
1622+
<tr>
1623+
<td align="center" valign="top" width="14.28%"><a href="https://surajanand88.github.io/portfolio/"><img src="https://avatars.githubusercontent.com/u/120190623?v=4?s=100" width="100px;" alt="Suraj Anand"/><br /><sub><b>Suraj Anand</b></sub></a><br /><a href="#content-SurajAnand88" title="Content">🖋</a></td>
1624+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MwitahJob"><img src="https://avatars.githubusercontent.com/u/136892656?v=4?s=100" width="100px;" alt="Mwitah "/><br /><sub><b>Mwitah </b></sub></a><br /><a href="#content-MwitahJob" title="Content">🖋</a></td>
1625+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/TucksonDev"><img src="https://avatars.githubusercontent.com/u/105675159?v=4?s=100" width="100px;" alt="Tuckson"/><br /><sub><b>Tuckson</b></sub></a><br /><a href="#content-TucksonDev" title="Content">🖋</a></td>
1626+
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/_Akamig"><img src="https://avatars.githubusercontent.com/u/6278999?v=4?s=100" width="100px;" alt="Akamig"/><br /><sub><b>Akamig</b></sub></a><br /><a href="#content-Akamig" title="Content">🖋</a></td>
16201627
</tr>
16211628
</tbody>
16221629
</table>

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ethereum-org-website",
3-
"version": "7.17.1",
3+
"version": "7.17.2",
44
"description": "Website of ethereum.org",
55
"main": "index.js",
66
"repository": "[email protected]:ethereum/ethereum-org-website.git",
@@ -17,7 +17,6 @@
1717
"@emotion/styled": "^11.9.3",
1818
"@formatjs/intl-locale": "^2.4.14",
1919
"@formatjs/intl-numberformat": "^6.1.4",
20-
"@googleapis/calendar": "^6.0.0",
2120
"@mdx-js/mdx": "^1.6.5",
2221
"@mdx-js/react": "^1.6.5",
2322
"algoliasearch": "^4.3.0",
@@ -56,7 +55,6 @@
5655
"gatsby-transformer-json": "^5.4.0",
5756
"gatsby-transformer-remark": "^6.4.0",
5857
"gatsby-transformer-sharp": "^5.4.0",
59-
"googleapis": "^118.0.0",
6058
"htmr": "^1.0.2",
6159
"i18next": "^21.9.2",
6260
"is-relative-url": "^3.0.0",
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import {
2+
createMultiStyleConfigHelpers,
3+
SystemStyleObject,
4+
} from "@chakra-ui/react"
5+
import { alertAnatomy } from "@chakra-ui/anatomy"
6+
import { alertDefaultTheme, defineMergeStyles } from "./components.utils"
7+
import { AlertStatusType } from "../../../components/Alert"
8+
9+
const STATUS_COLORS: Record<
10+
"solid" | "subtle",
11+
Record<AlertStatusType, SystemStyleObject>
12+
> = {
13+
solid: {
14+
error: {
15+
bg: "error.base",
16+
color: "error.light",
17+
},
18+
info: {
19+
bg: "body.medium",
20+
color: "background.base",
21+
},
22+
warning: {
23+
bg: "attention.base",
24+
color: "attention.light",
25+
},
26+
success: {
27+
bg: "success.base",
28+
color: "success.light",
29+
},
30+
},
31+
subtle: {
32+
error: {
33+
bg: "error.light",
34+
color: "error.base",
35+
},
36+
info: {
37+
bg: "background.highlight",
38+
color: "body.base",
39+
},
40+
warning: {
41+
bg: "attention.light",
42+
color: "gray.700",
43+
},
44+
success: {
45+
bg: "success.light",
46+
color: "success",
47+
},
48+
},
49+
}
50+
51+
const { baseStyle: alertBaseStyle } = alertDefaultTheme
52+
53+
const { defineMultiStyleConfig, definePartsStyle } =
54+
createMultiStyleConfigHelpers(alertAnatomy.keys)
55+
56+
const baseStyleContainer = defineMergeStyles(alertBaseStyle?.container, {
57+
justifyContent: "center",
58+
gap: 2,
59+
})
60+
61+
const baseStyleIcon = defineMergeStyles(alertBaseStyle?.icon, {
62+
me: 2,
63+
})
64+
65+
const baseStyle = definePartsStyle({
66+
container: baseStyleContainer,
67+
icon: baseStyleIcon,
68+
})
69+
70+
const variantSolid = definePartsStyle((props) => ({
71+
container: {
72+
...STATUS_COLORS["solid"][props.status],
73+
},
74+
}))
75+
76+
const variantSubtle = definePartsStyle((props) => ({
77+
container: {
78+
...STATUS_COLORS["subtle"][props.status],
79+
},
80+
}))
81+
82+
const variants = {
83+
solid: variantSolid,
84+
subtle: variantSubtle,
85+
}
86+
87+
export const Alert = defineMultiStyleConfig({
88+
baseStyle,
89+
variants,
90+
defaultProps: {
91+
variant: "solid",
92+
},
93+
})

src/@chakra-ui/gatsby-plugin/components/Button.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const baseStyle = defineStyle((props) => ({
3838
const variantSolid = defineStyle({
3939
color: "background.base",
4040
bg: "primary.base",
41+
borderColor: "transparent",
4142
_hover: {
4243
color: "background.base",
4344
bg: "primary.hover",

src/@chakra-ui/gatsby-plugin/components/components.utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { merge } from "lodash"
33

44
const {
55
Accordion: accordionDefaultTheme,
6+
Alert: alertDefaultTheme,
67
Avatar: avatarDefaultTheme,
78
Badge: badgeDefaultTheme,
89
Breadcrumb: breadcrumbDefaultTheme,
@@ -30,6 +31,7 @@ const {
3031

3132
export {
3233
accordionDefaultTheme,
34+
alertDefaultTheme,
3335
avatarDefaultTheme,
3436
badgeDefaultTheme,
3537
breadcrumbDefaultTheme,

src/@chakra-ui/gatsby-plugin/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Alert } from "./Alert"
12
import { Avatar } from "./Avatar"
23
import { Badge } from "./Badge"
34
import { Button } from "./Button"
@@ -28,6 +29,7 @@ import {
2829

2930
export default {
3031
Accordion: accordionDefaultTheme,
32+
Alert,
3133
Avatar,
3234
Badge,
3335
Breadcrumb: breadcrumbDefaultTheme,
1.94 MB
Loading
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import * as React from "react"
2+
import { Meta, StoryObj } from "@storybook/react"
3+
import Alert from "."
4+
import { Box, Flex, Text } from "@chakra-ui/react"
5+
6+
type AlertType = typeof Alert
7+
8+
const meta: Meta<AlertType> = {
9+
title: "Molecules / Action Feedback / Alerts",
10+
component: Alert,
11+
decorators: [
12+
(Story) => (
13+
<Flex flexDir="column" gap={4} width="3xl">
14+
<Story />
15+
</Flex>
16+
),
17+
],
18+
}
19+
20+
export default meta
21+
22+
type Story = StoryObj<AlertType>
23+
24+
const DEMO_DESC = "This is an alert to be used in the top of the content"
25+
26+
const STATUSES = ["error", "success", "warning", "info"] as const
27+
28+
export const StatusVariants: Story = {
29+
args: {
30+
description: DEMO_DESC,
31+
onClose: () => {},
32+
},
33+
render: (args) => (
34+
<>
35+
{STATUSES.map((status) => (
36+
<Alert key={status} status={status} {...args} />
37+
))}
38+
</>
39+
),
40+
}
41+
42+
export const ContentVariants: Story = {
43+
args: {
44+
description: DEMO_DESC,
45+
},
46+
render: (args) => (
47+
<>
48+
<Alert {...args} />
49+
<Alert hasIcon={false} {...args} />
50+
<Alert maxW="sm" onClose={() => {}} {...args} />
51+
</>
52+
),
53+
}
54+
55+
export const StyleVariants: Story = {
56+
args: {
57+
description: DEMO_DESC,
58+
onClose: () => {},
59+
},
60+
argTypes: {
61+
status: {
62+
options: STATUSES,
63+
control: {
64+
type: "radio",
65+
},
66+
},
67+
},
68+
render: (args) => (
69+
<>
70+
<Box>
71+
<Text>Solid</Text>
72+
<Alert {...args} />
73+
</Box>
74+
<Box>
75+
<Text>Subtle</Text>
76+
<Alert variant="subtle" {...args} />
77+
</Box>
78+
</>
79+
),
80+
}

src/components/Alert/index.tsx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import * as React from "react"
2+
import {
3+
Alert as ChakraAlert,
4+
AlertDescription,
5+
AlertIcon,
6+
AlertProps as ChakraAlertProps,
7+
AlertStatus,
8+
CloseButton,
9+
forwardRef,
10+
} from "@chakra-ui/react"
11+
12+
export type AlertStatusType = Exclude<AlertStatus, "loading">
13+
14+
interface AlertProps extends Omit<ChakraAlertProps, "status"> {
15+
/**
16+
* Should the alert icon show?
17+
*
18+
* @default true
19+
*/
20+
hasIcon?: boolean
21+
/**
22+
* The description of the alert
23+
*/
24+
description: string
25+
status?: AlertStatusType
26+
/**
27+
* Function to handle closing of the Alert
28+
*
29+
* If this prop is present, a `CloseButton` component is rendered
30+
*/
31+
onClose?: () => void
32+
}
33+
34+
const Alert = forwardRef<AlertProps, "div">((props, ref) => {
35+
const {
36+
hasIcon = true,
37+
description,
38+
onClose,
39+
status = "info",
40+
...rest
41+
} = props
42+
43+
const isCloseable = !!onClose
44+
45+
const closeButtonStateStyles = {
46+
borderRadius: "base",
47+
_active: {
48+
boxShadow: "none",
49+
transform: "translate(0)",
50+
transitionDuration: "20ms",
51+
},
52+
}
53+
54+
return (
55+
<ChakraAlert ref={ref} position="relative" status={status} {...rest}>
56+
<>
57+
{hasIcon ? <AlertIcon ms={isCloseable ? "auto" : undefined} /> : null}
58+
<AlertDescription>{description}</AlertDescription>
59+
{isCloseable ? (
60+
<CloseButton
61+
onClick={onClose}
62+
ms="auto"
63+
{...closeButtonStateStyles}
64+
/>
65+
) : null}
66+
</>
67+
</ChakraAlert>
68+
)
69+
})
70+
71+
export default Alert

0 commit comments

Comments
 (0)