Skip to content

Commit 1c3cfdc

Browse files
committed
remove customrootclass and contextprovider
1 parent bb80175 commit 1c3cfdc

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/core/primitives/Toggle/contexts/TogglePrimitiveContext.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { createContext } from "react";
22

33
interface TogglePrimitiveContextType {
4-
rootClass: string;
54
isPressed: boolean | undefined;
65
handlePressed: () => void;
76

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import React, { useState } from "react";
2-
import { customClassSwitcher } from "~/core/customClassSwitcher";
3-
import {TogglePrimitiveContext} from "../contexts/TogglePrimitiveContext";
42

53
export interface TogglePrimitiveRootProps {
64
defaultPressed? : boolean | false;
75
pressed: boolean;
8-
customRootClass?: string;
96
children?: React.ReactNode;
107
className?: string;
118
onChange : (isPressed:boolean) => void;
129

1310
}
14-
const TogglePrimitiveRoot = ({children,customRootClass='',className='',defaultPressed,pressed,onChange,...props}:TogglePrimitiveRootProps) => {
15-
const rootClass = customClassSwitcher(customRootClass,'Toggle');
16-
const [isPressed, setIsPressed] = useState(pressed || defaultPressed);
11+
const TogglePrimitiveRoot = ({children,className='',defaultPressed,pressed,onChange,...props}:TogglePrimitiveRootProps) => {
12+
const [isPressed, setIsPressed] = useState(pressed || defaultPressed);
1713

1814
const handlePressed = () => {
1915
const updatedPressed = !isPressed;
@@ -22,15 +18,13 @@ const TogglePrimitiveRoot = ({children,customRootClass='',className='',defaultPr
2218
}
2319

2420
const values = {
25-
rootClass,
2621
handlePressed,
2722
isPressed,
2823
setIsPressed
2924
};
3025

31-
return <TogglePrimitiveContext.Provider value={values}>
32-
<span className={`${rootClass} ${className}`} {...props}>{children}</span>
33-
</TogglePrimitiveContext.Provider>;
26+
return <span className={className}{...props}>{children}</span>
27+
3428
};
3529

3630
export default TogglePrimitiveRoot;

0 commit comments

Comments
 (0)