-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cecc08
commit ca1df9a
Showing
20 changed files
with
385 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules/ | ||
.turbo | ||
yarn-error.log | ||
yarn-error.log | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
## This is a Next.js project is to demo box-ui-elements in a Next.js app. | ||
|
||
### Getting Started | ||
|
||
Navigate to the `apps/nextjs` directory and run the following commands: | ||
|
||
```bash | ||
yarn build && yarn start | ||
``` | ||
|
||
Open [http://localhost:6061](http://localhost:6061) with your browser to see demos of the elements. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
"use client"; // This is necessary to ensure you are using the client-side version of React, box-ui-elements does not support SSR | ||
import { useEffect, useRef, useState } from "react"; | ||
|
||
const importAnnotations = () => | ||
import(/* webpackChunkName: "box-annotations" */ "box-annotations"); | ||
|
||
import dynamic from "next/dynamic"; | ||
|
||
// It is necessary to use dynamic, import the components from the es folder and setting SSR to false to avoid SSR issues | ||
const ContentPreview = dynamic( | ||
() => import("box-ui-elements/es/elements/content-preview"), | ||
{ ssr: false }, | ||
); | ||
|
||
import constants from "shared"; // shared configuration or settings among demos | ||
import ElementSection from "@/app/ElementSection"; | ||
|
||
export default function Annotations() { | ||
const defaultProps = { | ||
rootFolderId: constants.ROOTFOLDER_ID, | ||
token: constants.TOKEN, | ||
}; | ||
|
||
const boxAnnotations = useRef(null); | ||
const [annotationsLoaded, setAnnotationsLoaded] = useState(false); | ||
|
||
useEffect(() => { | ||
importAnnotations().then(() => { | ||
boxAnnotations.current = new global.BoxAnnotations(); | ||
setAnnotationsLoaded(true); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<h3>ContentPreview With Annotations</h3> | ||
<ElementSection> | ||
{annotationsLoaded && ( | ||
<ContentPreview | ||
boxAnnotations={boxAnnotations.current} | ||
contentSidebarProps={{ | ||
hasActivityFeed: true, | ||
features: { | ||
activityFeed: { | ||
annotations: { | ||
enabled: true, | ||
hasAccessStats: true, | ||
hasClassification: true, | ||
hasNotices: true, | ||
hasProperties: true, | ||
hasRetentionPolicy: true, | ||
hasVersions: true, | ||
}, | ||
}, | ||
}, | ||
}} | ||
hasHeader | ||
enableAnnotationsDiscoverability | ||
showAnnotations={annotationsLoaded} | ||
showAnnotationsControls | ||
showAnnotationsDrawing | ||
showAnnotationsDrawingCreate | ||
token={constants.TOKEN} | ||
fileId={constants.FILE_ID} | ||
/> | ||
)} | ||
</ElementSection> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.ElementSection { | ||
width: 100%; | ||
height: 500px; | ||
border: 1px solid #ccc; | ||
justify-items: center; | ||
align-content: center; | ||
} | ||
width: 100%; | ||
height: 500px; | ||
border: 1px solid #ccc; | ||
justify-items: center; | ||
align-content: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.