Skip to content

Commit 31e9917

Browse files
committed
update styled-components
1 parent e42c9c1 commit 31e9917

File tree

5 files changed

+2248
-381
lines changed

5 files changed

+2248
-381
lines changed

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"react-dom": "16.13.1",
2121
"react-github-corner": "^2.3.0",
2222
"react-scripts": "2.1.8",
23-
"styled-components": "4.2.0"
23+
"styled-components": "^6.0.5"
2424
},
2525
"scripts": {
2626
"start": "react-scripts start",

packages/gatsby-mdx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"react-code-blocks": "*",
2525
"react-dom": "^16.11.0",
2626
"react-helmet": "^5.2.0",
27-
"styled-components": "^4.2.0",
27+
"styled-components": "^6.0.5",
2828
"styled-system": "^4.2.2"
2929
},
3030
"keywords": [

packages/react-code-blocks/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@
7070
"react-dom": "^16.13.1",
7171
"ts-loader": "^6.2.2",
7272
"tsdx": "^0.13.2",
73-
"typescript": "^3.9.6",
73+
"typescript": "^5.1.6",
7474
"typescript-plugin-styled-components": "^1.4.4"
7575
},
7676
"dependencies": {
7777
"@babel/runtime": "^7.10.4",
7878
"@types/react-syntax-highlighter": "^15.5.7",
7979
"react-syntax-highlighter": "^15.5.0",
80-
"styled-components": "^5.1.1",
80+
"styled-components": "^6.0.5",
8181
"tslib": "^2.6.0"
8282
}
8383
}

packages/react-code-blocks/src/components/CopyBlock.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,24 @@ export interface CopyBlockProps {
3434
[x: string]: any;
3535
}
3636

37-
const Button = styled.button<CopyBlockProps>`
37+
type CascadedProps = Partial<CopyBlockProps> & { theme: Theme };
38+
39+
const Button = styled.button<CascadedProps>`
3840
position: absolute;
3941
top: 0.5em;
4042
right: 0.75em;
4143
display: flex;
4244
flex-wrap: wrap;
4345
justify-content: center;
4446
align-items: center;
45-
background: ${p => p.theme.backgroundColor};
47+
background: ${(p: CascadedProps) => p.theme.backgroundColor as string};
4648
margin-top: 0.15rem;
4749
border-radius: 0.25rem;
4850
max-height: 2rem;
4951
max-width: 2rem;
5052
padding: 0.25rem;
5153
&:hover {
52-
opacity: ${p => (p.copied ? 1 : 0.5)};
54+
opacity: ${(p: CascadedProps) => (p.copied ? 1 : 0.5)};
5355
}
5456
&:focus {
5557
outline: none;
@@ -61,11 +63,11 @@ const Button = styled.button<CopyBlockProps>`
6163
}
6264
`;
6365

64-
const Snippet = styled.div<CopyBlockProps>`
66+
const Snippet = styled.div<CascadedProps>`
6567
position: relative;
66-
background: ${p => p.theme.backgroundColor};
68+
background: ${(p: CascadedProps) => p.theme.backgroundColor as string};
6769
border-radius: 0.25rem;
68-
padding: ${p => (p.codeBlock ? `0.25rem 0.5rem 0.25rem 0.25rem` : `0.25rem`)};
70+
padding: ${(p: CascadedProps) => (p.codeBlock ? `0.25rem 0.5rem 0.25rem 0.25rem` : `0.25rem`)};
6971
`;
7072

7173
export default function CopyBlock({

0 commit comments

Comments
 (0)