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(theme): add twilio rebrand demo theme #4244

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
crossorigin="anonymous"
/>
<link rel="stylesheet" href="https://assets.twilio.com/public_assets/paste-fonts/1.5.2/fonts.css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Tektur:wght@400..900&display=swap" rel="stylesheet" />
<script>
window.global = window;
window.process = {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const globalTypes = {
// https://github.com/storybookjs/storybook/blob/master/lib/components/src/icon/icons.tsx
icon: "paintbrush",
// array of plain string values or MenuItem shape (see below)
items: ["default", "dark", "sendgrid", "evergreen", "twilio", "twilio-dark"],
items: ["default", "dark", "sendgrid", "evergreen", "twilio", "twilio-dark", "rebrand"],
},
},
theme_layout: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const DefaultAnchor = React.forwardRef<HTMLAnchorElement, AnchorProps>((props, r
outline="none"
ref={ref}
textDecoration="underline"
textUnderlineOffset="4px" // TODO: make work
_active={{
color: "colorTextLinkStrongest",
textDecoration: "none",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ describe("Button", () => {

expect(button).not.toHaveStyleRule("text-align", "left");
expect(button).toHaveStyleRule("color", "colorText");
expect(button).toHaveStyleRule("background-color", "colorBackgroundBody");
expect(button).toHaveStyleRule("background-color", "colorBackgroundWeak");
expect(button).toHaveStyleRule("box-shadow", "shadowBorderWeak");

expect(getByText("Secondary")).toHaveStyleRule("justify-content", "center");
Expand Down
8 changes: 4 additions & 4 deletions packages/paste-core/components/button/src/SecondaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import type { DirectButtonProps } from "./types";
*/
const defaultStyles: BoxStyleProps = merge(BaseStyles.default, {
color: "colorText",
backgroundColor: "colorBackgroundBody",
backgroundColor: "colorBackgroundWeak",
boxShadow: "shadowBorderWeak",
_hover: {
color: "colorTextPrimary",
backgroundColor: "colorBackgroundBody",
backgroundColor: "colorBackgroundWeaker",
boxShadow: "shadowBorderPrimary",
},
_focus: {
Expand All @@ -31,7 +31,7 @@ const defaultStyles: BoxStyleProps = merge(BaseStyles.default, {

const baseLoadingStyles: BoxStyleProps = {
color: "colorTextPrimary",
backgroundColor: "colorBackgroundBody",
backgroundColor: "colorBackgroundWeaker",
boxShadow: "shadowBorderWeak",
};

Expand All @@ -44,7 +44,7 @@ const loadingStyles: BoxStyleProps = merge(BaseStyles.loading, {

const baseDisabledStyles: BoxStyleProps = {
color: "colorTextWeaker",
backgroundColor: "colorBackgroundBody",
backgroundColor: "colorBackgroundWeaker",
boxShadow: "shadowBorderWeaker",
};

Expand Down
4 changes: 2 additions & 2 deletions packages/paste-core/components/button/src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export const SizeStyles: { [key in ButtonSizes]: BoxStyleProps } = {
default: {
paddingTop: "space30",
paddingBottom: "space30",
paddingLeft: "space40",
paddingRight: "space40",
paddingLeft: "space70",
paddingRight: "space70",
borderRadius: "borderRadius20",
fontSize: "fontSize30",
lineHeight: "lineHeight20",
Expand Down
7 changes: 4 additions & 3 deletions packages/paste-core/components/callout/src/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const variantStyles: Record<CalloutVariants, BoxStyleProps> = {
borderColor: "colorBorderNewWeak",
},
neutral: {
backgroundColor: "colorBackgroundWeak",
backgroundColor: "colorBackground",
color: "colorTextNeutral",
borderColor: "colorBorderNeutralWeak",
},
Expand Down Expand Up @@ -131,8 +131,9 @@ export const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(
display="flex"
marginY={marginY}
padding="space70"
borderLeftStyle="solid"
// borderLeftStyle="solid"
borderLeftWidth="borderWidth20"
borderRadius="borderRadius40"
variant={variant}
alignItems="start"
columnGap="space50"
Expand All @@ -146,7 +147,7 @@ export const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(
{children}
</Box>
{onDismiss && typeof onDismiss === "function" && (
<Button onClick={onDismiss} variant="secondary_icon" size="reset" element={`${element}_DISMISS_BUTTON`}>
<Button onClick={onDismiss} variant="secondary" size="circle_small" element={`${element}_DISMISS_BUTTON`}>
<CloseIcon element={`${element}_DISMISS_ICON`} decorative size="sizeIcon20" />
<ScreenReaderOnly>{i18nDismissLabel}</ScreenReaderOnly>
</Button>
Expand Down
2 changes: 1 addition & 1 deletion packages/paste-core/components/card/src/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Card = React.forwardRef<HTMLElement, CardProps>(
paddingLeft={paddingLeft}
paddingRight={paddingRight}
paddingTop={paddingTop}
backgroundColor="colorBackgroundBody"
backgroundColor="colorBackground"
>
{children}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const ChatComposerContainer = React.forwardRef<HTMLDivElement, ChatCompos
}}
padding="space30"
maxHeight={maxHeight}
overflowY="auto"
// overflowY="auto"
rowGap="space50"
width="100%"
{...Styles[variant]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const CodeBlockVariantStyles: Record<CodeBlockVariants, BoxStyleProps> = {
gridTemplateColumns: "1fr auto",
gridTemplateAreas: '"code-block button-group"',
columnGap: "space40",
borderRadius: "borderRadius20",
borderRadius: "borderRadius70",
paddingY: "space60",
},
"multi-line": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const CodeBlockHeader = React.forwardRef<HTMLHeadingElement, CodeBlockHea
paddingY="space50"
paddingX="space70"
margin="space0"
borderTopLeftRadius="borderRadius20"
borderTopRightRadius="borderRadius20"
borderTopLeftRadius="borderRadius70"
borderTopRightRadius="borderRadius70"
fontWeight="fontWeightSemibold"
fontSize="fontSize30"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const CodeBlockWrapper = React.forwardRef<HTMLDivElement, CodeBlockWrappe
<Tabs variant="inverse" state={state}>
<Box
backgroundColor="colorBackgroundInverseStrong"
borderRadius="borderRadius20"
borderRadius="borderRadius70"
overflow="hidden"
element={element}
ref={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const AnimatedDisclosureContent = animated(Box);
const baseContainedStyles: BoxStyleProps = {
borderWidth: "borderWidth10",
borderStyle: "solid",
borderBottomLeftRadius: "borderRadius20",
borderBottomRightRadius: "borderRadius20",
borderBottomLeftRadius: "borderRadius40",
borderBottomRightRadius: "borderRadius40",
borderTop: "none",
transition: "border-color 100ms ease-out",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { DisclosureVariants } from "./types";
const baseContainedStyles: BoxStyleProps = {
borderWidth: "borderWidth10",
borderStyle: "solid",
borderRadius: "borderRadius20",
borderRadius: "borderRadius40",
};

const containedStyles: BoxStyleProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const EditableCodeBlock: React.FC<EditableCodeBlockProps> = ({
);

return (
<Box element={element} borderRadius="borderRadius10" overflow="hidden">
<Box element={element} borderRadius="borderRadius70" overflow="hidden">
<StylingGlobals styles={globalStyles} />
<CodeEditor
{...props}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export const EditableCodeBlockHeader = React.forwardRef<HTMLHeadingElement, Edit
paddingY="space50"
paddingX="space70"
margin="space0"
borderTopLeftRadius="borderRadius20"
borderTopRightRadius="borderRadius20"
borderTopLeftRadius="borderRadius70"
borderTopRightRadius="borderRadius70"
fontWeight="fontWeightSemibold"
fontSize="fontSize30"
borderBottomWidth="borderWidth30"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as React from "react";
const StyledEditableCodeBlockWrapper = styled(Box)(
css({
backgroundColor: "rgb(1, 22, 39)", // Matches the Night Owl background theme
borderRadius: "borderRadius20",
borderRadius: "borderRadius70",
overflow: "hidden",
}),
);
Expand Down
4 changes: 4 additions & 0 deletions packages/paste-core/components/heading/src/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function getHeadingProps(headingVariant?: HeadingVariants, marginBottom?: "space
fontWeight: "fontWeightSemibold",
lineHeight: "lineHeight60",
letterSpacing: "-.02em",
color: "colorTextWeak",
};
case "heading40":
return {
Expand All @@ -29,6 +30,7 @@ function getHeadingProps(headingVariant?: HeadingVariants, marginBottom?: "space
fontWeight: "fontWeightSemibold",
lineHeight: "lineHeight40",
letterSpacing: "-.02em",
color: "colorTextWeak",
};
case "heading50":
return {
Expand All @@ -37,6 +39,7 @@ function getHeadingProps(headingVariant?: HeadingVariants, marginBottom?: "space
fontWeight: "fontWeightSemibold",
lineHeight: "lineHeight30",
letterSpacing: "-.02em",
color: "colorTextWeak",
};
case "heading60":
return {
Expand All @@ -45,6 +48,7 @@ function getHeadingProps(headingVariant?: HeadingVariants, marginBottom?: "space
fontWeight: "fontWeightSemibold",
lineHeight: "lineHeight20",
letterSpacing: "-.02em",
color: "colorTextWeak",
};
/**
* heading20 is out of order because its also default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { FauxInputProps } from "../types";

const DefaultFauxInput = React.forwardRef<HTMLDivElement, React.PropsWithChildren<FauxInputProps>>(
({ disabled, element, hasError, readOnly, children, type, variant }, ref) => {
let backgroundColor = "colorBackgroundBody" as BackgroundColor;
let backgroundColor = "colorBackgroundWeaker" as BackgroundColor;
let boxShadow = "shadowBorder" as BoxShadow;
let boxShadowHover = "shadowBorderPrimary" as BoxShadow;
let boxShadowActive = "shadowBorderPrimaryStronger" as BoxShadow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const MinimizableDialogContent = React.forwardRef<HTMLDivElement, MinimizableDia
element={element}
ref={ref}
display={minimized ? "none" : "block"}
borderBottomLeftRadius="borderRadius20"
borderBottomRightRadius="borderRadius20"
borderBottomLeftRadius="borderRadius40"
borderBottomRightRadius="borderRadius40"
>
{children}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const MinimizableDialogHeader = React.forwardRef<HTMLDivElement, MinimizableDial
borderBottomWidth="borderWidth10"
borderBottomStyle="solid"
borderBottomColor="colorBorderWeaker"
borderTopRightRadius="borderRadius20"
borderTopLeftRadius="borderRadius20"
borderTopRightRadius="borderRadius40"
borderTopLeftRadius="borderRadius40"
element={element}
>
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const StyledMinimizableDialog: React.FC<React.PropsWithChildren<Pick<BoxP
}) => (
<Box
element={element}
borderRadius="borderRadius20"
borderRadius="borderRadius40"
display="flex"
flexDirection="column"
backgroundColor="colorBackgroundBody"
Expand Down
5 changes: 3 additions & 2 deletions packages/paste-core/components/sidebar/src/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ const StyledSidebar = React.forwardRef<HTMLDivElement, BoxProps>((props, ref) =>
display="flex"
flexDirection="column"
ref={ref}
borderRightStyle="solid"
boxShadow="shadowElevationRightInverse05"
// borderRightStyle="solid"
borderRightWidth="borderWidth10"
borderRightColor="colorBorderInverseWeaker"
backgroundColor="colorBackgroundInverse"
backgroundColor="colorBackgroundBodyInverse"
zIndex="zIndex50"
position="fixed"
top={0}
Expand Down
1 change: 1 addition & 0 deletions packages/paste-core/components/sidebar/src/SidebarBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const SidebarBody = React.forwardRef<HTMLDivElement, SidebarBodyProps>(
maxHeight="100%"
overflow="hidden"
flexGrow={1}
flexShrink={0}
>
{children}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ export const SidebarHeader = React.forwardRef<HTMLButtonElement, SidebarHeaderPr
paddingX="space60"
minHeight="sizeTopbar"
borderBottomWidth="borderWidth10"
borderBottomStyle="solid"
// borderBottomStyle="solid"
borderBottomColor="colorBorderInverseWeaker"
boxShadow="shadowElevationBottomInverse05"
display="flex"
alignItems="center"
justifyContent="flex-start"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ export const SidebarNavigation = React.forwardRef<HTMLDivElement, SidebarNavigat
maxHeight="100%"
overflowY="auto"
overflowX="hidden"
paddingY="space50"
paddingLeft="space60"
paddingRight={collapsed ? "space40" : "space60"}
paddingY="space100"
paddingLeft="space30"
paddingRight={collapsed ? "space30" : "space60"}
flexGrow={1}
display="flex"
flexDirection="column"
alignItems="center"
>
{children}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ const SidebarNavigationItem = React.forwardRef<HTMLAnchorElement, SidebarNavigat
...(collapsed && sidebarNavigationItemCollapsedStyles),
...(selected && sidebarNavigationItemSelectedStyles),
display: collapsed && hideItemsOnCollapse ? "none" : "flex",
width: collapsed ? "36px" : "100%",
width: collapsed ? "58px" : "100%",
height: "58px",
}),
[isNested, selected, collapsed, hideItemsOnCollapse, hierarchical],
);
Expand All @@ -96,26 +97,35 @@ const SidebarNavigationItem = React.forwardRef<HTMLAnchorElement, SidebarNavigat
as="a"
aria-current={selected ? "page" : undefined}
{...styles}
justifyContent="center"
alignItems="center"
>
{icon && (
<Box as="span" color={selected ? "colorTextInverse" : "colorTextIconInverse"}>
<Box
as="span"
color={selected ? "colorTextInverse" : "colorTextIconInverse"}
_hover={{ color: "colorTextInverse" }}
>
{icon}
</Box>
)}
<Box
as="span"
display="flex"
alignItems="center"
justifyContent="space-between"
columnGap="space20"
transition="all 120ms ease"
flexGrow={1}
float={visible ? "none" : "left"}
opacity={visible ? 1 : 0}
whiteSpace={visible ? "normal" : "nowrap"}
>
{collapsed ? null : children}
</Box>
{!collapsed && (
<Box
as="span"
display="flex"
alignItems="center"
justifyContent="space-between"
columnGap="space20"
transition="all 120ms ease"
flexGrow={1}
flexShrink={0}
float={visible ? "none" : "left"}
opacity={visible ? 1 : 0}
whiteSpace={visible ? "normal" : "nowrap"}
>
{collapsed ? null : children}
</Box>
)}
</Box>
);
},
Expand Down
Loading
Loading