-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added web view id to web view menu commands, moved projectId(s) to sa…
…ved web view definition, spread saved web view definition into web view props instead of just updatable props and run function to access, allowed getting saved web view definitions from backend, exercised with hello world extension
- Loading branch information
1 parent
5003dc5
commit 77dc12e
Showing
20 changed files
with
559 additions
and
240 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
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
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
31 changes: 31 additions & 0 deletions
31
...src/hello-world/src/web-views/hello-world-project/hello-world-project-viewer.web-view.tsx
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,31 @@ | ||
import { WebViewProps } from '@papi/core'; | ||
import { useProjectData, useProjectSetting } from '@papi/frontend/react'; | ||
import { CSSProperties, useMemo } from 'react'; | ||
|
||
const namesDefault: string[] = []; | ||
|
||
globalThis.webViewComponent = function HelloWorldProjectViewer({ projectId }: WebViewProps) { | ||
const [names] = useProjectData('helloWorld', projectId).Names(undefined, namesDefault); | ||
|
||
const [headerSize] = useProjectSetting('helloWorld', projectId, 'helloWorld.headerSize', 15); | ||
|
||
const [headerColor] = useProjectSetting( | ||
'helloWorld', | ||
projectId, | ||
'helloWorld.headerColor', | ||
'Black', | ||
); | ||
|
||
const headerStyle = useMemo<CSSProperties>( | ||
() => ({ fontSize: `${headerSize}pt`, color: headerColor }), | ||
[headerSize, headerColor], | ||
); | ||
|
||
return ( | ||
<div className="top"> | ||
{names.map((name) => ( | ||
<div style={headerStyle}>Hello, {name}!</div> | ||
))} | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
|
@@ -6,3 +6,7 @@ | |
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.remove-name-button { | ||
margin-right: 10px; | ||
} |
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.