From 88bcc124259523c621e6cf9292c8253f97a347f5 Mon Sep 17 00:00:00 2001
From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Date: Tue, 30 Apr 2024 12:59:26 -0300
Subject: [PATCH] organize components for better reuse and less duplication
---
docs/src/components/action/NpmCopyButton.tsx | 5 +-
.../productDesignKit/DesignKitDemo.tsx | 304 ++++++++++--------
2 files changed, 167 insertions(+), 142 deletions(-)
diff --git a/docs/src/components/action/NpmCopyButton.tsx b/docs/src/components/action/NpmCopyButton.tsx
index de9efd9e45a99b..f773a49352c3ae 100644
--- a/docs/src/components/action/NpmCopyButton.tsx
+++ b/docs/src/components/action/NpmCopyButton.tsx
@@ -13,6 +13,7 @@ const Button = styled('button')(({ theme }) => ({
marginTop: 16,
cursor: 'copy',
padding: 0,
+ position: 'relative',
display: 'inline-flex',
alignItems: 'flex-start',
justifyContent: 'center',
@@ -43,8 +44,8 @@ const Button = styled('button')(({ theme }) => ({
},
'& svg': {
display: 'inline-block',
- position: 'relative',
- right: 3,
+ position: 'absolute',
+ right: -24,
top: 1,
opacity: 0,
transition: theme.transitions.create('opacity', {
diff --git a/docs/src/components/productDesignKit/DesignKitDemo.tsx b/docs/src/components/productDesignKit/DesignKitDemo.tsx
index e5b13fe187de3e..72637f25411e37 100644
--- a/docs/src/components/productDesignKit/DesignKitDemo.tsx
+++ b/docs/src/components/productDesignKit/DesignKitDemo.tsx
@@ -34,7 +34,163 @@ const Image = styled('img')(({ theme }) => ({
}),
}));
-export default function TemplateDemo() {
+interface MaterialFigmaComponentsProps {
+ fadeIn?: boolean;
+}
+
+export function MaterialFigmaComponents({ fadeIn }: MaterialFigmaComponentsProps) {
+ return (
+
+
+ theme.applyDarkStyles({
+ '&:hover': {
+ '& img': {
+ filter: 'drop-shadow(-16px 12px 20px rgba(0, 0, 0, 0.4))',
+ },
+ },
+ }),
+ ]}
+ >
+
+ theme.applyDarkStyles({
+ content: `url(/static/branding/design-kits/Button-dark.jpeg)`,
+ })
+ }
+ />
+
+ theme.applyDarkStyles({
+ content: `url(/static/branding/design-kits/Alert-dark.jpeg)`,
+ })
+ }
+ />
+
+ theme.applyDarkStyles({
+ content: `url(/static/branding/design-kits/Slider-dark.jpeg)`,
+ })
+ }
+ />
+
+
+ );
+}
+
+export function MaterialDesignKitInfo() {
+ return (
+
+
+
+ Available in:
+
+ img': { width: 20, height: 20 } }}>
+
+
+
+
+
+
+ We frequently update them to stay up-to-date with the latest release.
+
+
+ }
+ >
+ Buy it now
+
+
+ }
+ >
+ Figma Preview
+
+
+
+ );
+}
+
+export default function DesignKitsDemo() {
const [demo, setDemo] = React.useState(DEMOS[0]);
const icons = {
[DEMOS[0]]: ,
@@ -74,98 +230,15 @@ export default function TemplateDemo() {
-
-
- theme.applyDarkStyles({
- '&:hover': {
- '& img': {
- filter: 'drop-shadow(-16px 12px 20px rgba(0, 0, 0, 0.4))',
- },
- },
- }),
- ]}
- >
-
- theme.applyDarkStyles({
- content: `url(/static/branding/design-kits/Button-dark.jpeg)`,
- })
- }
- />
-
- theme.applyDarkStyles({
- content: `url(/static/branding/design-kits/Alert-dark.jpeg)`,
- })
- }
- />
-
- theme.applyDarkStyles({
- content: `url(/static/branding/design-kits/Slider-dark.jpeg)`,
- })
- }
- />
-
-
+
({
@@ -182,8 +255,8 @@ export default function TemplateDemo() {
({
@@ -199,56 +272,7 @@ export default function TemplateDemo() {
/>
-
-
-
- Available in:
-
- img': { width: 22, height: 22 } }}>
-
-
-
-
-
-
- We frequently update them to stay up-to-date with the latest release.
-
-
- }
- >
- Buy it now
-
-
- }
- >
- Figma Preview
-
-
-
+