mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
After trying out draft mode on canary, I realized that it was easy to select the wrong option from the VS Code intellisense suggestion dropdown. So this PR changes `enabled` to `isEnabled` and also wraps in a class to make the icons for methods look different. ## Before <img width="545" alt="image" src="https://user-images.githubusercontent.com/229881/235705729-2be5a5a0-2299-4152-bee7-b6d5659a8d59.png"> ## After <img width="545" alt="image" src="https://user-images.githubusercontent.com/229881/235733072-338dfb2f-9e27-4d04-b009-a66503efe682.png">
19 lines
373 B
TypeScript
19 lines
373 B
TypeScript
import React from 'react'
|
|
import { draftMode } from 'next/headers'
|
|
|
|
export default function Page() {
|
|
const { isEnabled } = draftMode()
|
|
|
|
return (
|
|
<>
|
|
<h1>Draft Mode Test</h1>
|
|
<p>
|
|
Random: <em id="rand">{Math.random()}</em>
|
|
</p>
|
|
<p>
|
|
State: <strong id="mode">{isEnabled ? 'ENABLED' : 'DISABLED'}</strong>
|
|
</p>
|
|
</>
|
|
)
|
|
}
|