Skip to content

Commit

Permalink
Fixed text color and tooltip z-index attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
belousovjr committed Nov 22, 2023
1 parent e538917 commit 783cddb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@reach/portal": "^0.18.0",
"@real-wagmi/sdk": "^1.1.6",
"@storybook/addon-themes": "^7.5.3",
"@styled-system/should-forward-prop": "^5.1.5",
"@types/styled-system": "^5.1.15",
"framer-motion": "10.11.2",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/components/breadcrumbs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ it("should render breadcrumbs and redirect with click", async () => {
/>
</svg>
<div
class="c3 css-ldvhnx"
class="c3 css-vurnku"
>
${label}
</div>
Expand Down
9 changes: 6 additions & 3 deletions src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import { variant } from "styled-system";
import { typographyVariants } from "./theme";
import { typographies } from "./types";
import { ReactNode } from "react";
import shouldForwardProp from "@styled-system/should-forward-prop";

type TextProps = Omit<TextPropsOriginal, "variant" | "color"> & {
color?: keyof ThemeColors;
color?: keyof ThemeColors | string;
variant?: (typeof typographies)[keyof typeof typographies];
children?: ReactNode;
};

const TextWrap = styled(TextOrig)<TextProps>`
color: ${({ theme, color }) => theme.colors[color as string] || color || theme.colors.white};
const TextWrap = styled(TextOrig).withConfig({
shouldForwardProp,
})<TextProps>`
color: ${({ theme, color }) => theme.colors[color] || color || theme.colors.white};
${variant({
prop: "variant",
variants: typographyVariants,
Expand Down
2 changes: 2 additions & 0 deletions src/components/Text/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const Text: React.FC<React.PropsWithChildren> = () => {
<TextComponent variant="button">Button/Regular</TextComponent>
<TextComponent variant="caption">Caption/Regular</TextComponent>
<TextComponent variant="overline">Overline/Regular</TextComponent>

<TextComponent color="red">Red text</TextComponent>
</Grid>
);
};
3 changes: 3 additions & 0 deletions src/components/Tooltip/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from "styled-components";
import { Z_INDEX } from "../../constants";

export const Arrow = styled.div`
width: 8px;
Expand Down Expand Up @@ -48,4 +49,6 @@ export const TooltipContainer = styled.div<{ show: boolean }>`
word-break: break-word;
background: ${({ theme }) => theme.colors.darkBg};
border-radius: 8px;
z-index: ${Z_INDEX.TOOLTIP};
`;
1 change: 1 addition & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export enum SCREEN_WIDTH {

export enum Z_INDEX {
DROPDOWN = 100,
TOOLTIP = 1000
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@
dependencies:
"@styled-system/core" "^5.1.2"

"@styled-system/should-forward-prop@^5.0.0":
"@styled-system/should-forward-prop@^5.0.0", "@styled-system/should-forward-prop@^5.1.5":
version "5.1.5"
resolved "https://registry.yarnpkg.com/@styled-system/should-forward-prop/-/should-forward-prop-5.1.5.tgz#c392008c6ae14a6eb78bf1932733594f7f7e5c76"
integrity sha512-+rPRomgCGYnUIaFabDoOgpSDc4UUJ1KsmlnzcEp0tu5lFrBQKgZclSo18Z1URhaZm7a6agGtS5Xif7tuC2s52Q==
Expand Down

0 comments on commit 783cddb

Please sign in to comment.