Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added box shadows to theme STC-831 #178

Merged
merged 3 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ export interface AccordionProps {
| "text"
| "success"
| "warning"
className?: HTMLAttributes<HTMLDivElement>["className"]
}

const Accordion = ({
children,
initialOpenIndex,
activeBackgroundColor = "secondary",
className,
}: AccordionProps) => {
const [openIndex, setOpenIndex] = useState<number | undefined>(
initialOpenIndex
Expand All @@ -63,7 +65,7 @@ const Accordion = ({
</AccordionContext.Provider>
))

return <div>{insertDivider(allItems)}</div>
return <div className={className}>{insertDivider(allItems)}</div>
}

export interface AccordionItemProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Autocomplete/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export default forwardRef(function Autocomplete<T>(
background: "#fff",
border: "1px solid #E8E8E9",
borderRadius: 4,
boxShadow: "0px 1px 12px rgba(0, 0, 0, 0.16)",
boxShadow: "main",
flexWrap: props.multiSelect ? "wrap" : undefined,
minWidth: containerRef.current?.getClientRects()[0].width,
outline: "0",
Expand Down
5 changes: 2 additions & 3 deletions src/components/EditableField/ButtonControl/ButtonControl.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsxImportSource theme-ui */
import React, { MouseEvent, useMemo } from "react"
import { get, ThemeUICSSObject } from "theme-ui"
import { ThemeUICSSObject } from "theme-ui"
import Button from "../../Button/Button"
import Spinner from "../../Spinner/Spinner"

Expand All @@ -22,8 +22,7 @@ const ButtonControl = ({
const buttonStyles: ThemeUICSSObject = useMemo(
() => ({
backgroundColor: "#FFF",
boxShadow: (theme) =>
`0px 1px 12px ${get(theme, "colors.text.alpha.85")}`,
boxShadow: "dark",
borderRadius: 2,

"&:hover": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MobileModal/MobileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ const MobileModal = ({
borderBottomRightRadius: 0,
borderStyle: `solid`,
borderWidth: `1px`,
boxShadow: `0px 1px 12px rgba(0, 0, 0, 0.04)`,
boxShadow: "main",
left: 0,
height: !topSpacing ? `100vh` : `fit-content`,
maxHeight: `calc(100vh - ${topSpacing}px)`,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Paper/Paper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const Paper = ({
onClick,
}: PaperProps) => {
const boxShadow = useMemo(() => {
if (elevation === 1) return "0px 1px 12px rgba(0, 0, 0, 0.04);"
if (elevation >= 2) return "0px 1px 12px rgba(0, 0, 0, 0.16)"
if (elevation === 1) return "main"
if (elevation >= 2) return "dark"

return "none"
}, [elevation])
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const Popover = ({
outline: 0,
transitionProperty: "transform,visibility,opacity",
borderRadius,
boxShadow: "0px 1px 12px rgba(0, 0, 0, 0.16)",
boxShadow: "dark",
".tippy-content": {
position: "relative",
...(noPadding
Expand Down
2 changes: 1 addition & 1 deletion src/components/Snackbar/Snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Snackbar = ({ type, title, body, onClose }: SnackbarProps) => {
padding: 3,
width: "fit-content",
backgroundColor: "text",
boxShadow: "0px 1px 4px rgba(0, 0, 0, 0.2)",
boxShadow: "dark",
borderRadius: 3,
color: "text.40",
}}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SubNavigationMenu/SubNavigationMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const SubNavigationMenu = ({
}}
sx={{
backgroundColor: "#ffffff",
boxShadow: "0px 1px 12px rgba(29, 29, 29, 0.16)",
boxShadow: "dark",
padding: "6px",
position: "absolute",
right: "-14px",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const TabPanel = ({ children, index }: TabPanelProps) => {
border: "1px solid",
borderColor: "text.90",
backgroundColor: "text.95",
boxShadow: isOpen ? "0px 1px 12px rgba(0, 0, 0, 0.04)" : "none",
boxShadow: isOpen ? "main" : "none",
}}
>
{children}
Expand Down
4 changes: 4 additions & 0 deletions src/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export const theme: Theme = {
body: 20 / 14,
},

shadows: {
main: `0px 1px 12px ${colorPalette.text.alpha["95"]}`,
dark: `0px 1px 12px ${colorPalette.text.alpha["85"]}`,
},
text: {
default: {
fontFamily: "body",
Expand Down
Binary file modified tests/images/Design System/Accordion/Default/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/Accordion/Default/firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/Accordion/With Initial Open/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/Card/Default/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/Card/Default/firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/FloatingCard/Default/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/FloatingCard/Default/firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/MobileModal/Default/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/MobileModal/Default/firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/MobileModal/Dismissible/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/MobileModal/Dismissible/firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/MobileModal/Draggable/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/MobileModal/Draggable/firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/Paper/Example/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/Design System/Paper/Example/firefox.png
Binary file modified tests/images/Design System/Paper/Higher Elevation/chrome.png
Binary file modified tests/images/Design System/Paper/Higher Elevation/firefox.png
Binary file modified tests/images/Design System/Popover/Dark Theme/chrome.png
Binary file modified tests/images/Design System/Popover/Dark Theme/firefox.png
Binary file modified tests/images/Design System/Popover/Light Theme/chrome.png
Binary file modified tests/images/Design System/Popover/Light Theme/firefox.png
Binary file modified tests/images/Design System/Popover/With Arrow/chrome.png
Binary file modified tests/images/Design System/Popover/With Arrow/firefox.png
Binary file modified tests/images/Design System/Snackbar/Error/chrome.png
Binary file modified tests/images/Design System/Snackbar/Error/firefox.png
Binary file modified tests/images/Design System/Snackbar/Example/chrome.png
Binary file modified tests/images/Design System/Snackbar/Example/firefox.png
Binary file modified tests/images/Design System/Snackbar/Loading/chrome.png
Binary file modified tests/images/Design System/Snackbar/Loading/firefox.png
Binary file modified tests/images/Design System/Snackbar/Success/chrome.png
Binary file modified tests/images/Design System/Snackbar/Success/firefox.png
Binary file modified tests/images/Design System/SubNavigationMenu/Default/chrome.png
Binary file modified tests/images/Design System/Tab/Default/chrome.png
Binary file modified tests/images/Design System/Tab/Default/firefox.png
Binary file modified tests/images/Design System/Tab/With Initial Open/chrome.png
Binary file modified tests/images/Design System/Tab/With Initial Open/firefox.png
Binary file modified tests/images/Design System/Table/Active Row Example/chrome.png
Binary file modified tests/images/Design System/Table/Active Row Example/firefox.png
Binary file modified tests/images/Design System/Table/Example/chrome.png
Binary file modified tests/images/Design System/Table/Example/firefox.png
Binary file modified tests/images/Design System/Table/Loading Default/chrome.png
Binary file modified tests/images/Design System/Table/Loading Default/firefox.png
Binary file modified tests/images/Design System/Table/Select Rows Example/chrome.png
Binary file modified tests/images/Design System/Table/Select Rows Example/firefox.png
Binary file modified tests/images/Design System/Tooltip/Always Visible/chrome.png
Binary file modified tests/images/Design System/Tooltip/Always Visible/firefox.png