Skip to content

Commit

Permalink
Merge pull request #1806 from ChainSafe/dev
Browse files Browse the repository at this point in the history
Release 2021-12-06
  • Loading branch information
FSM1 authored Dec 8, 2021
2 parents b6d64dd + e3778cf commit 2ff26fe
Show file tree
Hide file tree
Showing 170 changed files with 2,579 additions and 6,898 deletions.
6 changes: 2 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": 0,
"react/jsx-max-props-per-line": [2, {
"maximum": 1,
"when": "always"
}],
"react/jsx-max-props-per-line": ["error", { "maximum": 1, "when": "always" }],
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
"react/jsx-fragments": "error",
"arrow-spacing": "error",
"space-infix-ops": "error",
Expand Down
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
closes #

---

Submission checklist:

<!-- Remove anything below that is not applicable -->

#### Layout
- [] Change looks good in the desktop web ui
- - [] Change looks good in the mobile web ui

#### Theme
- [] Components / elements inspected in light mode
- [] Components / elements inspected in dark mode
40 changes: 0 additions & 40 deletions .github/workflows/lingui-extract-gaming.yml

This file was deleted.

4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ Theme context and other utilities for generating and using the theming capabilit

The UI for Chainsafe Files

#### **`packages/gaming-ui`**

The UI for Chainsafe Gaming

#### **`packages/storage-ui`**

The UI for Chainsafe Storage
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"eslint": "^6.8.0",
"eslint-plugin-cypress": "^2.11.3",
"eslint-plugin-no-only-tests": "^2.6.0",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-ternary": "^1.0.4",
"npm-run-all": "^4.1.5",
Expand All @@ -38,9 +38,6 @@
"build:files-ui": "yarn wsrun -p files-ui -c build",
"release:files-ui": "yarn wsrun -p files-ui -c release",
"start:files-ui": "yarn wsrun -p files-ui -c start",
"build:gaming-ui": "yarn wsrun -p gaming-ui -c build",
"release:gaming-ui": "yarn wsrun -p gaming-ui -c release",
"start:gaming-ui": "yarn wsrun -p gaming-ui -c start",
"build:storage-ui": "yarn wsrun -p storage-ui -c build",
"release:storage-ui": "yarn wsrun -p storage-ui -c release",
"start:storage-ui": "yarn wsrun -p storage-ui -c start",
Expand Down
2 changes: 1 addition & 1 deletion packages/common-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"storybook": "start-storybook -p 6006",
"build:storybook": "build-storybook",
"build:storybook": "(export NODE_OPTIONS=--openssl-legacy-provider; build-storybook)",
"build": "rollup -c",
"start": "rollup -c -w",
"lint": "eslint './{src, cypress}/**/*.{js,jsx,ts,tsx}'"
Expand Down
20 changes: 17 additions & 3 deletions packages/common-components/src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const useStyles = makeStyles(
fill: palette.common.white.main
},
"&:hover": {
backgroundColor: palette.primary.main,
backgroundColor: palette.primary.hover,
color: palette.common.white.main,
...overrides?.Button?.variants?.secondary?.hover
},
Expand All @@ -109,6 +109,20 @@ const useStyles = makeStyles(
},
...overrides?.Button?.variants?.secondary?.root
},
text: {
backgroundColor: "transparent",
color: palette.additional["gray"][9],
"&:hover": {
...overrides?.Button?.variants?.text?.hover
},
"&:focus": {
...overrides?.Button?.variants?.text?.focus
},
"&:active": {
...overrides?.Button?.variants?.text?.active
},
...overrides?.Button?.variants?.text?.root
},
tertiary: {
backgroundColor: palette.additional["gray"][3],
color: palette.common.black.main,
Expand Down Expand Up @@ -293,7 +307,7 @@ interface IButtonProps extends Omit<ReactButton, "size"> {
className?: string
children?: ReactNode | ReactNode[]
fullsize?: boolean
variant?: "link" | "primary" | "secondary" |"tertiary" | "outline" | "dashed" | "danger"
variant?: "link" | "primary" | "secondary" |"tertiary" | "outline" | "dashed" | "danger" | "text"
iconButton?: boolean
size?: "large" | "medium" | "small"
type?: "button" | "submit" | "reset"
Expand Down Expand Up @@ -347,7 +361,7 @@ const Button: React.FC<IButtonProps> = ({
{loading && (
<>
<Loading
type="inherit"
type="initial"
size={16}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const useStyles = makeStyles(
root: {
cursor: "pointer",
display: "flex",
alignItems: "center",
...overrides?.CheckboxInput?.root
},
checkbox: {
Expand Down
7 changes: 7 additions & 0 deletions packages/common-components/src/Icons/icons/Sort.icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from "react"
import createSvgIcon from "../createSvgIcon"
import { ReactComponent as SortSvg } from "../svgs/sort.svg"

export { SortSvg }

export default createSvgIcon(<SortSvg />)
1 change: 1 addition & 0 deletions packages/common-components/src/Icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export { default as SearchIcon, SearchSvg } from "./icons/Search.icon"
export { default as SettingIcon, SettingSvg } from "./icons/Setting.icon"
export { default as ShareAltIcon, ShareAltSvg } from "./icons/ShareAlt.icon"
export { default as StarIcon, StarSvg } from "./icons/Star.icon"
export { default as SortIcon, SortSvg } from "./icons/Sort.icon"
export { default as SunIcon, SunSvg } from "./icons/Sun.icon"
export { default as TableIcon, TableSvg } from "./icons/Table.icon"
export { default as UpdateIcon, UpdateSvg } from "./icons/Update.icon"
Expand Down
4 changes: 1 addition & 3 deletions packages/common-components/src/Icons/svgs/document.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 1 addition & 13 deletions packages/common-components/src/Icons/svgs/ethereum-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/common-components/src/Icons/svgs/sort.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/common-components/src/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const useStyles = makeStyles(
margin: "auto",
maxHeight: "100%",
overflow: "auto",
alignItems: "center",
"&.xs": {
width: `calc(100% - ${constants.generalUnit * 2}px)`,
maxWidth: breakpoints.width("xs"),
Expand Down
1 change: 0 additions & 1 deletion packages/common-components/src/SelectInput/SelectInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const useStyles = makeStyles(
({ animation, constants, palette, overrides }: ITheme) =>
createStyles({
root: {
margin: 5,
display: "block",
...overrides?.SelectInput?.root
},
Expand Down
56 changes: 42 additions & 14 deletions packages/common-components/src/Spinner/Loading.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react"
import React, { useMemo } from "react"
import { ITheme, useTheme } from "@chainsafe/common-theme"

export interface ILoadingProps {
type?: "inherit" | "primary" | "dark" | "light"
type?: "initial" | "primary" | "dark" | "light"
size?: number
className?: string
}
Expand All @@ -13,6 +13,42 @@ const Loading: React.FC<ILoadingProps> = ({
className
}) => {
const theme: ITheme = useTheme()

const uniqueKey = `${Math.random()}-${Math.random()}`

const {
start,
end
} = useMemo(() => {
switch (type) {
case "primary":
return {
start: theme.palette.primary.main,
end: "transparent"
}
case "light":
return {
start: theme.palette.common.white.main,
end: "transparent"
}
case "dark":
return {
start: theme.palette.common.black.main,
end: "transparent"
}
case "initial":
return {
start: "#FFFFFF",
end: "transparent"
}
default:
return {
start: "#FFFFFF",
end: "transparent"
}
}
}, [type, theme.palette])

return (
<svg
width={size}
Expand All @@ -22,35 +58,27 @@ const Loading: React.FC<ILoadingProps> = ({
>
<defs>
<linearGradient
id="gradient"
id={`gradient-${uniqueKey}`}
x1="0%"
y1="0%"
x2="0%"
y2="100%"
>
<stop
offset="0%"
stopColor={
type === "primary"
? theme.palette.primary.main
: type === "dark"
? theme.palette.common.black.main
: theme.palette.additional["gray"][5]
}
stopColor={start}
/>
<stop
offset="100%"
stopColor={
type === "light" ? theme.palette.common.white.main : "transparent"
}
stopColor={end}
/>
</linearGradient>
</defs>
<circle
cx="50"
cy="50"
r="47"
stroke="url(#gradient)"
stroke={`url(#gradient-${uniqueKey})`}
strokeWidth="6"
fill="none"
transform="rotate(90 50 50)"
Expand Down
3 changes: 2 additions & 1 deletion packages/common-components/src/Toasts/ToastContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ const ToastContent = ({ toast, onClose }: ToastContentProps) => {
/>
{onProgressCancel &&
onProgressCancelLoading
? <Loading size={16}
? <Loading
size={16}
className={classes.progressCrossButton} />
: <CloseCirceSvg
className={classes.progressCrossButton}
Expand Down
4 changes: 3 additions & 1 deletion packages/common-components/src/stories/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ export const actionsData = {
onClick: action("onClickButton")
}

type VariantOption = "primary" | "secondary" | "tertiary" | "outline" | "dashed" | "danger" | undefined;
type VariantOption = "primary" | "secondary" | "tertiary" | "link" | "text" | "outline" | "dashed" | "danger" | undefined;
const variantOptions: VariantOption[] = [
"primary",
"outline",
"dashed",
"danger",
"link",
"text",
undefined
]

Expand Down
3 changes: 2 additions & 1 deletion packages/common-components/src/stories/Tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const TabsDemo = (): React.ReactNode => {
activeKey={tab}
onTabSelect={setTab}
>
<TabPane title="tab 1"
<TabPane
title="tab 1"
tabKey="1"
>
first
Expand Down
9 changes: 5 additions & 4 deletions packages/common-components/src/stories/Toasts.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ const ToastNotificationDemo: React.FC<{toast: ToastParams}> = ({ toast }) => {
<br />
{toasts.map((toast) => (
toast.progress && toast.progress < 80 ? (
<button onClick={() => updateToast(toast.id, {
...toast,
progress: toast.progress !== undefined ? toast.progress + 20 : undefined
})}>
<button
onClick={() => updateToast(toast.id, {
...toast,
progress: toast.progress !== undefined ? toast.progress + 20 : undefined
})}>
increase progress toast
</button>
) : null
Expand Down
12 changes: 12 additions & 0 deletions packages/common-theme/src/Overrides/Button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ export interface IButtonOverride {
focus?: Record<string, any>
active?: Record<string, any>
}
link?: {
root?: Record<string, any>
hover?: Record<string, any>
focus?: Record<string, any>
active?: Record<string, any>
}
text?: {
root?: Record<string, any>
hover?: Record<string, any>
focus?: Record<string, any>
active?: Record<string, any>
}
}
state?: {
danger?: {
Expand Down
Loading

0 comments on commit 2ff26fe

Please sign in to comment.