MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / toggleFavorite

Function toggleFavorite

src/components/common/TabsLayout.jsx:145–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143 }, [favoriteKey]);
144
145 const toggleFavorite = () => {
146 if (!favoriteKey) return;
147 const { saved } = toggleSavedComponent(favoriteKey);
148 setIsSaved(saved);
149
150 const nameEl = (
151 <span>
152 {' '}
153 <span style={{ color: colors.accent, fontWeight: 700 }}>&lt;{componentName} /&gt;</span>
154 </span>
155 );
156
157 if (saved) toast.success?.(<>Added {nameEl} to favorites</>) ?? toast(<>Added {nameEl} to favorites</>);
158 else toast.error?.(<>Removed {nameEl} from favorites</>) ?? toast(<>Removed {nameEl} from favorites</>);
159 };
160 const contentMap = {
161 PreviewTab: null,
162 CodeTab: null

Callers

nothing calls this directly

Calls 1

toggleSavedComponentFunction · 0.90

Tested by

no test coverage detected