Skip to content

Commit

Permalink
refactor(tree): simplify class handling
Browse files Browse the repository at this point in the history
RISDEV-0000
  • Loading branch information
hamo225 committed Oct 23, 2024
1 parent 0fe90c1 commit 8492391
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
17 changes: 0 additions & 17 deletions src/primevue/tree/tree.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
span[data-pc-section="nodelabel"]:has(a + span) {
@apply gap-4;
}

span[data-pc-section="nodelabel"] a,
span[data-pc-section="nodelabel"] span {
@apply w-full focus:outline-none;
}

span[data-pc-section="nodelabel"] :first-child {
@apply group-hover:underline;
}

span[data-pc-section="nodelabel"] span:last-child {
@apply group-hover:no-underline;
}

div[data-pc-section="nodecontent"]:has(
+ ul[data-pc-section="nodechildren"]
li
Expand Down
18 changes: 4 additions & 14 deletions src/primevue/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ import { tw } from "@/lib/tags.ts";
import "./tree.css";

const tree: TreePassThroughOptions = {
node: () => {
const focus = tw`focus-visible:outline-none focus-visible:outline-4 focus-visible:outline-offset-4 focus-visible:outline-blue-800`;
return {
class: {
[focus]: true,
},
};
node: {
class: tw`focus-visible:outline-none focus-visible:outline-4 focus-visible:outline-offset-4 focus-visible:outline-blue-800`,
},
nodeContent: ({ context }) => {
const base = tw`group ris-label2-bold flex w-full gap-4 border-l-4 border-transparent py-10 pl-10 pr-20 text-blue-800 hover:bg-gray-100`;
Expand Down Expand Up @@ -49,13 +44,8 @@ const tree: TreePassThroughOptions = {
},
};
},
nodeLabel: () => {
const base = tw`group flex w-full flex-col items-start outline-none group-hover:text-black`;
return {
class: {
[base]: true,
},
};
nodeLabel: {
class: tw`group flex w-full flex-col items-start outline-none *:w-full *:outline-none group-hover:text-black [&>*:first-child]:group-hover:underline [&>*:last-child]:group-hover:no-underline`,
},
};

Expand Down

0 comments on commit 8492391

Please sign in to comment.