Skip to content

Commit f153be7

Browse files
committed
feat: apply logo to default trigger
1 parent 97ace61 commit f153be7

File tree

4 files changed

+69
-15
lines changed

4 files changed

+69
-15
lines changed

packages/example/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import "./App.css";
22
import { MSWDevTool } from "@msw-dev-tool/react";
3-
import "@msw-dev-tool/react/msw-dev-tool.css";
43
import { useMsw } from "./hooks/useMsw";
54
import { UserList } from "./components/UserList";
65
import { UserInfo } from "./components/UserInfo";

packages/react/src/style/trigger.css

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
.msw-dt-default-trigger {
2-
background-color: rgb(234 88 12);
3-
border-radius: 0.5rem;
4-
padding: 0.5rem;
5-
color: white;
6-
margin: 1rem;
72
position: fixed;
8-
bottom: 0;
9-
left: 0;
3+
bottom: 1.5rem;
4+
left: 1.5rem;
105
z-index: 9999;
116
cursor: pointer;
127
display: flex;
13-
gap: 0.5rem;
8+
justify-content: center;
149
align-items: center;
10+
padding: 0;
11+
border:none;
12+
background-color: transparent;
13+
outline: none;
14+
box-shadow: none;
15+
margin: 0;
16+
appearance: none;
17+
user-select: none;
18+
-webkit-tap-highlight-color: transparent;
1519
}
1620

17-
.msw-dt-default-trigger:hover {
18-
background-color: rgb(249 115 22);
21+
.msw-dt-default-trigger svg {
22+
border: 1px solid #c7c7c7;
23+
border-radius: 1rem;
24+
color: #101010;
1925
}
26+
27+
.msw-dt-default-trigger svg:hover {
28+
color: #202020;
29+
}
30+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React from "react";
2+
3+
export const MSWDevToolLogo = ({
4+
size = "28",
5+
backgroundColor = "#101010",
6+
color = "#FF6600",
7+
className,
8+
}: {
9+
size?: string | number;
10+
backgroundColor?: string;
11+
color?: string;
12+
className?: string;
13+
}) => {
14+
return (
15+
<svg
16+
width={size}
17+
height={size}
18+
viewBox="0 0 28 28"
19+
fill="none"
20+
xmlns="http://www.w3.org/2000/svg"
21+
className={className}
22+
>
23+
<rect
24+
width="28"
25+
height="28"
26+
rx="5"
27+
fill={backgroundColor}
28+
/>
29+
<rect
30+
width="24"
31+
height="24"
32+
transform="translate(2 2)"
33+
fill={backgroundColor}
34+
/>
35+
<path
36+
d="M24 10C24 13.3135 21.3135 16 18 16C16.9865 16 16.032 15.7485 15.195 15.305L6.5 24L4 21.5L12.695 12.805C12.2373 11.941 11.9987 10.9778 12 10C12 6.6865 14.6865 4 18 4C19.0135 4 19.968 4.251 20.805 4.695L17 8.5L19.5 11L23.305 7.195C23.7627 8.05905 24.0013 9.02222 24 10Z"
37+
fill={color}
38+
stroke={color}
39+
strokeWidth="0.5"
40+
strokeLinecap="round"
41+
strokeLinejoin="round"
42+
/>
43+
</svg>
44+
);
45+
};

packages/react/src/ui/Trigger.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import React, { ComponentProps, forwardRef } from "react";
2-
import { CodeIcon } from "@radix-ui/react-icons";
32
import styles from "../style/trigger.css";
3+
import { MSWDevToolLogo } from "./Components/Logo";
44

55
export const DefaultDevToolTrigger = forwardRef<
66
HTMLButtonElement,
77
ComponentProps<"button">
88
>((props, ref) => {
99
return (
1010
<>
11-
<button ref={ref} className="msw-dt-default-trigger" {...props}>
12-
<CodeIcon width={"1rem"} height={"1rem"} />
13-
msw
11+
<button ref={ref} className="msw-dt-default-trigger" name="msw-dev-tool trigger" {...props}>
12+
<MSWDevToolLogo size={"3rem"} backgroundColor="currentColor" />
1413
</button>
1514
<style type="text/css">{styles}</style>
1615
</>

0 commit comments

Comments
 (0)