From a8f043728f1978aaae922df13f6ffad8960e835e Mon Sep 17 00:00:00 2001 From: Mert Akinc <7282195+m-akinc@users.noreply.github.com> Date: Thu, 2 May 2024 15:05:00 -0500 Subject: [PATCH] Fix ShadowRootWithPart story --- stories/ShadowRootWithPart.css | 23 +++++++++++++++++++++++ stories/ShadowRootWithPart.js | 28 +--------------------------- 2 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 stories/ShadowRootWithPart.css diff --git a/stories/ShadowRootWithPart.css b/stories/ShadowRootWithPart.css new file mode 100644 index 0000000..4bd2474 --- /dev/null +++ b/stories/ShadowRootWithPart.css @@ -0,0 +1,23 @@ +::part(foo) { + font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 700; + border: 0; + border-radius: 3em; + cursor: pointer; + display: inline-block; + line-height: 1; + color: white; + background-color: tomato; + font-size: 14px; + padding: 11px 20px; +} +::part(foo):hover { + text-decoration: underline; +} +::part(foo):focus { + box-shadow: inset 0 0 0 2px maroon; + outline: 0; +} +::part(foo):active { + background-color: firebrick; +} diff --git a/stories/ShadowRootWithPart.js b/stories/ShadowRootWithPart.js index 8c2c782..a835d8a 100644 --- a/stories/ShadowRootWithPart.js +++ b/stories/ShadowRootWithPart.js @@ -1,4 +1,5 @@ import React from "react" +import "./ShadowRootWithPart.css" export const ShadowRoot = ({ label = "Hello from shadow DOM" }) => { const ref = React.useRef() @@ -9,33 +10,6 @@ export const ShadowRoot = ({ label = "Hello from shadow DOM" }) => { ref.current.shadowRoot.innerHTML = ` ` - ref.current.innerHTML = ` - - ` }, []) return