mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-18 19:39:51 +08:00
chore(site): support for opening debug component demos (#39132)
This commit is contained in:
parent
134647d12f
commit
880a57298e
@ -101,7 +101,7 @@ type AnchorItem = {
|
|||||||
|
|
||||||
const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
|
const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
|
||||||
const meta = useRouteMeta();
|
const meta = useRouteMeta();
|
||||||
const { pathname } = useLocation();
|
const { pathname, hash } = useLocation();
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const styles = useStyle();
|
const styles = useStyle();
|
||||||
const { direction } = useContext(SiteContext);
|
const { direction } = useContext(SiteContext);
|
||||||
@ -112,8 +112,10 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
|
|||||||
[meta],
|
[meta],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isDebugDemo = debugDemos.includes(hash.slice(1));
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
setShowDebug(process.env.NODE_ENV === 'development');
|
setShowDebug(process.env.NODE_ENV === 'development' || isDebugDemo);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const contextValue = useMemo<DemoContextProps>(
|
const contextValue = useMemo<DemoContextProps>(
|
||||||
|
Loading…
Reference in New Issue
Block a user