@powerhousedao/academy 0.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +9 -0
- package/Dockerfile +31 -0
- package/ProcFile +1 -0
- package/README.md +43 -0
- package/babel.config.js +3 -0
- package/blog/BeyondCommunication-ABlueprintForDevelopment.md +88 -0
- package/blog/TheChallengeOfChange.md +86 -0
- package/blog/images/Iteration.png +0 -0
- package/blog/images/RAD.png +0 -0
- package/docs/academy/01-GetStarted/00-GetStarted.mdx +181 -0
- package/docs/academy/01-GetStarted/01_InstallDemoPackage.md +38 -0
- package/docs/academy/01-GetStarted/02-ToDoList/01-CreateNewPowerhouseProject.md +97 -0
- package/docs/academy/01-GetStarted/02-ToDoList/02-DefineToDoListDocumentModel.md +86 -0
- package/docs/academy/01-GetStarted/02-ToDoList/03-ImplementOperationReducers.md +201 -0
- package/docs/academy/01-GetStarted/02-ToDoList/04-BuildToDoListEditor.md +494 -0
- package/docs/academy/01-GetStarted/02-ToDoList/_category_.json +8 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/DocumentModelHeader.png +0 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/DocumentModelOperations.png +0 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/OpenDocumentModelEditor.gif +0 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/completeEditor.png +0 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/connectApp.gif +0 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/form.png +0 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/mytodolist.gif +0 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/reducers.png +0 -0
- package/docs/academy/01-GetStarted/02-ToDoList/images/vscode.png +0 -0
- package/docs/academy/01-GetStarted/styles.module.css +99 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/00-BuilderTools.md +234 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/01-SetupBuilderEnvironment.md +247 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/04-UtilitiesAndTips.md +79 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/01-SetupBuilderEnvironment.md +216 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/02-CreateNewPowerhouseProject.md +78 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/03-DefineChatroomDocumentModel.md +139 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/04-ImplementOperationReducers.md +364 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/05-ImplementChatroomEditor.md +194 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/06-LaunchALocalReactor.md +15 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/_category_.json +8 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/image-1.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/image-2.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/image-3.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/image-4.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/image-5.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/image.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/images/ChatRoomConnectApp.gif +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/images/ChatRoomTest.gif +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/images/completeEditor.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/images/form.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/images/reducers.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/Chatroom/images/vscode.png +0 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-MoreTutorials/_category_.json +8 -0
- package/docs/academy/02-AdvancedTutorial/01-Create/02-StandardDocumentModelWorkflow.md +229 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/01-BuildingBeautifulDocumentEditors.md +109 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/02-ConfiguringDrives.md +51 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +174 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/07-DocumentTools/01-OperationHistory.md +67 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/07-DocumentTools/02-RevisionHistoryTimeline.md +132 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/07-DocumentTools/_category_.json +7 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/07-DocumentTools/images/committer-address-popup.png +0 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/07-DocumentTools/images/revision-hash-popup.png +0 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/07-DocumentTools/images/revision-history-list.png +0 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/07-DocumentTools/images/signature-details-popup.png +0 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/_category_.json +8 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/images/CreateDrive.png +0 -0
- package/docs/academy/02-AdvancedTutorial/03-BuildingUserExperiences/images/mytodolist.gif +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/01-ReadingAndWritingThroughTheAPI.mdx +121 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/02-GraphQLAtPowerhouse.md +156 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/03-WorkingWithSubgraphs/02-GraphQLAndSubgraphs.mdx +119 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/03-WorkingWithSubgraphs/03-WorkingWithSubgraphs.md +312 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/03-WorkingWithSubgraphs/_category_.json +8 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/04-analytics-processor.md +342 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/01-SetupBuilderEnvironment.md +215 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/02-CreateNewPowerhouseProject.md +55 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/03-GenerateAnAnalyticsProcessor.md +173 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/04-UpdateAnalyticsProcessor.md +223 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/_category_.json +8 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/images/Create-SPV.gif +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/images/Create-a-new-asset.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/images/Create-a-transaction.gif +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/images/Transaction-table.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/images/create-a-new-RWA-document.gif +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/05-AnalyticsProcessorTutorial/images/granularity.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +244 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/GraphQL References/rwa-reports/listener-raw.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/GraphQL References/rwa-reports/raw-reports1.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/GraphQL References/rwa-reports/raw-reports2.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/GraphQL References/rwa-reports/rwaRegister.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/apse.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/best-practices.md +60 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/filter.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/filteroptions.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/graphql/index.md +166 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/graphql/integration.md +75 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/dbs.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/high-level.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/indexeddb.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/libs-core.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/libs.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/lod.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/logo.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/navbar.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/overview-1.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/overview-2.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/overview-3.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/overview-4.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/overview-5.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/overview-6.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/paths-1.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/images/paths-2.jpg +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/intro.md +149 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/typescript/benchmarks.md +27 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/typescript/browser.md +77 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/typescript/compatibility.md +14 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/typescript/index.md +230 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/typescript/memory.md +72 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/typescript/pg.md +63 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/typescript/schema.md +14 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +102 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/use-cases/index.md +7 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +652 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/06-Analytics Engine/use-cases/processors.md +3 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/_category_.json +8 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/images/OperationHistory.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/images/OperationsQuery.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/images/QueryDocumentID.png +0 -0
- package/docs/academy/02-AdvancedTutorial/04-WorkWithData/images/SwitchboardButton.png +0 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/00-IntegrateInAFront-End +3 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/01-IntroducingFusion +18 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/02-IntroductionToPackages.md +79 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/02-PublishYourProject.md +230 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/03-RunOnACloudServer.md +279 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/03-SetupEnvironment.md +436 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/04-GraphQLNamespacing +44 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/05-LaunchYourBackend.md +3 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/06-LaunchYourFrontend.md +3 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/_category_.json +8 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/images/SSHConnection.png +0 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/images/homedesign.png +0 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/images/keyconcepts.png +0 -0
- package/docs/academy/02-AdvancedTutorial/05-Launch/images/tutorialschema.png +0 -0
- package/docs/academy/02-AdvancedTutorial/06-Authorization/Authorization.md +100 -0
- package/docs/academy/02-AdvancedTutorial/_category_.json +7 -0
- package/docs/academy/03-APIReferences/00-PowerhouseCLI.md +1 -0
- package/docs/academy/03-APIReferences/_category_.json +7 -0
- package/docs/academy/04-ComponentLibrary/01-PowerhouseDesignSystem.md +94 -0
- package/docs/academy/04-ComponentLibrary/02-BuildingWithScalars.md +54 -0
- package/docs/academy/04-ComponentLibrary/03-Scalar-Components/01-phid-field.mdx +72 -0
- package/docs/academy/04-ComponentLibrary/03-Scalar-Components/02-input-field.mdx +0 -0
- package/docs/academy/04-ComponentLibrary/04-Complex-Components/01-sidebar.mdx +36 -0
- package/docs/academy/04-ComponentLibrary/05-Layout-Components/01-test-toupdate.mdx +61 -0
- package/docs/academy/04-ComponentLibrary/06-Fragments/01-test-toupdate.mdx +61 -0
- package/docs/academy/04-ComponentLibrary/_category_.json +8 -0
- package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +50 -0
- package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +48 -0
- package/docs/academy/05-Architecture/02-ReferencingMonorepoPackages +65 -0
- package/docs/academy/05-Architecture/04-MovingBeyondCRUD +61 -0
- package/docs/academy/05-Architecture/05-DocumentModelTheory/01-WhatIsADocumentModel.md +188 -0
- package/docs/academy/05-Architecture/05-DocumentModelTheory/02-DAOandDocumentsModelsQ+A.md +177 -0
- package/docs/academy/05-Architecture/05-DocumentModelTheory/02-domain-modeling.md +103 -0
- package/docs/academy/05-Architecture/05-DocumentModelTheory/03-BenefitsOfDocumentModels.md +95 -0
- package/docs/academy/05-Architecture/05-DocumentModelTheory/05-best-practices.md +257 -0
- package/docs/academy/05-Architecture/05-DocumentModelTheory/_category_.json +8 -0
- package/docs/academy/05-Architecture/05-DocumentModelTheory/three-data-layers.png +0 -0
- package/docs/academy/05-Architecture/_category_.json +7 -0
- package/docs/academy/05-Architecture/images/image.png +0 -0
- package/docs/academy/06-Cookbook.md +905 -0
- package/docs/academy/07-Glossary.md +50 -0
- package/docs/bookofpowerhouse/01-Overview.md +29 -0
- package/docs/bookofpowerhouse/02-GeneralFrameworkAndPhilosophy.md +15 -0
- package/docs/bookofpowerhouse/03-PowerhouseSoftwareArchitecture.md +33 -0
- package/docs/bookofpowerhouse/04-DevelopmentApproaches.md +36 -0
- package/docs/bookofpowerhouse/05-SNOsandANewModelForOSSandPublicGoods.md +73 -0
- package/docs/bookofpowerhouse/06-SNOsInActionAndPlatformEconomies.md +17 -0
- package/docs/renown/01-intro.md +18 -0
- package/docs/renown/02-renown-login-flow.md +60 -0
- package/docusaurus +0 -0
- package/docusaurus.config.ts +170 -0
- package/package.json +50 -0
- package/powerhouse-docs@0.0.0 +0 -0
- package/sidebars.ts +33 -0
- package/src/components/HomepageFeatures/index.tsx +250 -0
- package/src/components/HomepageFeatures/styles.module.css +267 -0
- package/src/css/custom.css +450 -0
- package/src/pages/index.module.css +37 -0
- package/src/pages/index.tsx +42 -0
- package/src/pages/markdown-page.md +7 -0
- package/static/.nojekyll +0 -0
- package/static/fonts/FranieBold.otf +0 -0
- package/static/fonts/FranieRegular.otf +0 -0
- package/static/img/Powerhouse Website Drive.png +0 -0
- package/static/img/Powerhouse Website Storage Layer (1).png +0 -0
- package/static/img/Powerhouse Website Storage Layer.png +0 -0
- package/static/img/Powerhouse-main-light.svg +13 -0
- package/static/img/Powerhouse-main.svg +13 -0
- package/static/img/Renown Intro Diagram.png +0 -0
- package/static/img/Union.svg +3 -0
- package/static/img/academy/icons/Advanced.svg +4 -0
- package/static/img/academy/icons/Book.svg +5 -0
- package/static/img/academy/icons/Cookbook.svg +3 -0
- package/static/img/academy/icons/Create.svg +3 -0
- package/static/img/academy/icons/Data.svg +3 -0
- package/static/img/academy/icons/Editor.svg +3 -0
- package/static/img/academy/icons/Flash.svg +3 -0
- package/static/img/academy/icons/Launch.svg +3 -0
- package/static/img/academy-icon.png +0 -0
- package/static/img/connect-icon.png +0 -0
- package/static/img/connect.png +0 -0
- package/static/img/docusaurus-social-card.jpg +0 -0
- package/static/img/docusaurus.png +0 -0
- package/static/img/empty-background.png +0 -0
- package/static/img/favicon.ico +0 -0
- package/static/img/fusion-icon.png +0 -0
- package/static/img/fusion.png +0 -0
- package/static/img/ph-icon-light.svg +3 -0
- package/static/img/powerhouse-layer.png +0 -0
- package/static/img/powerhouse-storage-layer.png +0 -0
- package/static/img/reactor.png +0 -0
- package/static/img/renown-icon.png +0 -0
- package/static/img/renown.png +0 -0
- package/static/img/switchboard-icon.png +0 -0
- package/static/img/switchboard.png +0 -0
- package/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/static/img/undraw_docusaurus_react.svg +170 -0
- package/static/img/undraw_docusaurus_tree.svg +40 -0
- package/static/img/video-placeholder.svg +16 -0
- package/static.json +7 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
# Build a Todo-list Editor
|
|
2
|
+
|
|
3
|
+
In this chapter we will continue with the interface or editor implementation of the **ToDoList** document model editor. This means you will create a simple user interface for the **ToDoList** document model which will be used inside the Connect app to create, update and delete your ToDoList items.
|
|
4
|
+
|
|
5
|
+
## Generate the editor template
|
|
6
|
+
|
|
7
|
+
Run the command below to generate the editor template for the **ToDoList** document model. This command reads the **ToDoList** document model definition from the `document-models` folder and generates the editor template in the `editors/to-do-list/editor.tsx` folder.
|
|
8
|
+
|
|
9
|
+
Notice the `--editor` flag which defines the **ToDoList** document model. And the `--document-types` flag which defines the document type `powerhouse/todolist`.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
ph generate --editor ToDoList --document-types powerhouse/todolist
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Once complete, navigate to the `editors/to-do-list/editor.tsx` file and open it in your editor.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Editor Implementation Options
|
|
19
|
+
|
|
20
|
+
When building your editor component within the Powerhouse ecosystem, you have several options for styling, allowing you to leverage your preferred methods:
|
|
21
|
+
|
|
22
|
+
1. **Default HTML Styling:** Standard HTML tags (`<h1>`, `<p>`, `<button>`, etc.) will render with default browser styles or any base styling provided by the Connect environment. This is the simplest approach for basic structure.
|
|
23
|
+
2. **Tailwind CSS:** Connect Studio comes with Tailwind CSS integrated. You can directly use Tailwind utility classes for rapid, consistent styling without writing separate CSS files.
|
|
24
|
+
3. **Custom CSS Files:** You can import traditional CSS files (`.css`) to apply custom styles or integrate existing style libraries.
|
|
25
|
+
|
|
26
|
+
Connect Studio provides a dynamic local environment (`ph connect`) to visualize your components instantly as you build them, regardless of the styling method you choose. Manual build steps are typically only needed when publishing packages.
|
|
27
|
+
|
|
28
|
+
Let's look at a simple example component structure and how each styling method can be applied.
|
|
29
|
+
|
|
30
|
+
**Example Component Structure (Base HTML with inline styles)**
|
|
31
|
+
|
|
32
|
+
<details>
|
|
33
|
+
<summary>Base HTML Example</summary>
|
|
34
|
+
|
|
35
|
+
Here's a basic editor structure using only standard HTML tags.
|
|
36
|
+
This demonstrates how elements look with very minimal default styling:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { EditorProps } from 'document-model';
|
|
40
|
+
// Assuming a simple document model for demonstration
|
|
41
|
+
// import { ExampleDocument, actions } from '../../document-models/example';
|
|
42
|
+
|
|
43
|
+
// Replace with your actual document type props if needed
|
|
44
|
+
export type IProps = EditorProps<any>;
|
|
45
|
+
|
|
46
|
+
export default function Editor({ document, dispatch }: IProps) {
|
|
47
|
+
return (
|
|
48
|
+
<div>
|
|
49
|
+
<h1 style={{ fontWeight: 'bold' }}>Document Title</h1>
|
|
50
|
+
<h2>Document Subtitle</h2>
|
|
51
|
+
<input
|
|
52
|
+
type="text"
|
|
53
|
+
placeholder="Small text input"
|
|
54
|
+
style={{ border: '1px solid gray', marginBottom: '0.5rem' }}
|
|
55
|
+
/>
|
|
56
|
+
<textarea
|
|
57
|
+
placeholder="Large text area"
|
|
58
|
+
rows={4}
|
|
59
|
+
style={{ border: '1px solid gray', display: 'block', marginBottom: '0.5rem' }}
|
|
60
|
+
/>
|
|
61
|
+
<button style={{ backgroundColor: 'yellow' }}>
|
|
62
|
+
Submit
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
</details>
|
|
69
|
+
|
|
70
|
+
*Run `ph connect` to see the default styles applied to components in real-time.*
|
|
71
|
+
|
|
72
|
+
**Styling with Tailwind CSS**
|
|
73
|
+
|
|
74
|
+
<details>
|
|
75
|
+
<summary>Tailwind CSS Example</summary>
|
|
76
|
+
|
|
77
|
+
Now, let's add Tailwind utility classes to the same structure for styling:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { EditorProps } from 'document-model';
|
|
81
|
+
// import { ExampleDocument, actions } from '../../document-models/example';
|
|
82
|
+
|
|
83
|
+
export type IProps = EditorProps<any>;
|
|
84
|
+
|
|
85
|
+
export default function Editor({ document, dispatch }: IProps) {
|
|
86
|
+
return (
|
|
87
|
+
<div className="p-4 space-y-4"> {/* Add padding and spacing */}
|
|
88
|
+
<h1 className="text-2xl font-bold">Document Title</h1> {/* Style heading */}
|
|
89
|
+
<h2 className="text-lg text-gray-600 mb-4">Document Subtitle</h2> {/* Style subheading */}
|
|
90
|
+
<input
|
|
91
|
+
type="text"
|
|
92
|
+
placeholder="Small text input"
|
|
93
|
+
className="w-full p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-500 mb-4" // Style input
|
|
94
|
+
/>
|
|
95
|
+
<textarea
|
|
96
|
+
placeholder="Large text area"
|
|
97
|
+
rows={4}
|
|
98
|
+
className="w-full p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-500" // Style textarea
|
|
99
|
+
/>
|
|
100
|
+
<button className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded transition-colors"> {/* Style button */}
|
|
101
|
+
Submit
|
|
102
|
+
</button>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
</details>
|
|
108
|
+
|
|
109
|
+
*Run `ph connect` to see these Tailwind styles applied in real-time.*
|
|
110
|
+
|
|
111
|
+
**Styling with a Custom CSS File**
|
|
112
|
+
|
|
113
|
+
<details>
|
|
114
|
+
<summary>Custom CSS File Example</summary>
|
|
115
|
+
|
|
116
|
+
You can also import a standard CSS file.
|
|
117
|
+
|
|
118
|
+
1. Create a CSS file (e.g., `editor.css`) in the same directory as your `editor.tsx`:
|
|
119
|
+
|
|
120
|
+
```css
|
|
121
|
+
/* editors/your-editor/editor.css */
|
|
122
|
+
.editor-container {
|
|
123
|
+
padding: 1rem;
|
|
124
|
+
border: 1px solid #ccc;
|
|
125
|
+
border-radius: 4px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.editor-title {
|
|
129
|
+
color: rgb(51, 51, 54);
|
|
130
|
+
font-size: 2rem;
|
|
131
|
+
margin-bottom: 4px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.editor-subtitle {
|
|
135
|
+
color: rgb(51, 51, 54);
|
|
136
|
+
font-size: 1.5rem;
|
|
137
|
+
margin-bottom: 4px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.editor-button {
|
|
141
|
+
background-color: green;
|
|
142
|
+
color: white;
|
|
143
|
+
padding: 0.5rem 1rem;
|
|
144
|
+
border: none;
|
|
145
|
+
border-radius: 4px;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.editor-button:hover {
|
|
150
|
+
background-color: darkgreen;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
2. Import the CSS file and use the classes in your component:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { EditorProps } from 'document-model';
|
|
158
|
+
// import { ExampleDocument, actions } from '../../document-models/example';
|
|
159
|
+
import './editor.css'; // Import the CSS file
|
|
160
|
+
|
|
161
|
+
export type IProps = EditorProps<any>;
|
|
162
|
+
|
|
163
|
+
export default function Editor({ document, dispatch }: IProps) {
|
|
164
|
+
return (
|
|
165
|
+
<div className="editor-container"> {/* Use custom class */}
|
|
166
|
+
<h1 className="editor-title">Document Title</h1> {/* Use custom class */}
|
|
167
|
+
<h2 className="editor-subtitle">Document Subtitle</h2> {/* Default or other styles */}
|
|
168
|
+
<input
|
|
169
|
+
type="text"
|
|
170
|
+
placeholder="Small text input"
|
|
171
|
+
className="w-full p-2 border rounded mb-4" // Can mix with Tailwind/defaults
|
|
172
|
+
/>
|
|
173
|
+
<textarea
|
|
174
|
+
placeholder="Large text area"
|
|
175
|
+
rows={4}
|
|
176
|
+
className="w-full p-2 border rounded mb-4" // Can mix with Tailwind/defaults
|
|
177
|
+
/>
|
|
178
|
+
<button className="editor-button"> {/* Use custom class */}
|
|
179
|
+
Submit
|
|
180
|
+
</button>
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
</details>
|
|
186
|
+
|
|
187
|
+
*Run `ph connect` to see your custom CSS styles applied.*
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## To-do List Editor
|
|
192
|
+
|
|
193
|
+
:::tip
|
|
194
|
+
### Implementing Components
|
|
195
|
+
The editor we are about to implement makes use of some components from the **Powerhouse Design System**.
|
|
196
|
+
When you'll add the editor code you'll see it makes use of two components, the `Checkbox` and `InputField`.
|
|
197
|
+
These are imported from the Powerhouse Design System (`@powerhousedao/design-system/scalars`).
|
|
198
|
+
|
|
199
|
+
This system provides a library of reusable components to ensure consistency and speed up development.
|
|
200
|
+
You can explore available components, see usage examples, and understand their properties (props) using our Storybook instance. For a detailed guide on how to leverage the design system and Storybook, see [using the Powerhouse Design System](/docs/academy/ComponentLibrary/PowerhouseDesignSystem) page.
|
|
201
|
+
|
|
202
|
+
For our tutorial you can now create a `components` folder in the `editors/to-do-list` folder and add the following code to each of the components
|
|
203
|
+
:::
|
|
204
|
+
|
|
205
|
+
<details>
|
|
206
|
+
<summary>Checkbox</summary>
|
|
207
|
+
```typescript
|
|
208
|
+
import { Form, BooleanField } from "@powerhousedao/design-system/scalars";
|
|
209
|
+
|
|
210
|
+
interface CheckboxProps {
|
|
211
|
+
value: boolean;
|
|
212
|
+
onChange: (value: boolean) => void;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export const Checkbox = ({ value, onChange }: CheckboxProps) => {
|
|
216
|
+
return (
|
|
217
|
+
<Form onSubmit={() => {}}>
|
|
218
|
+
<BooleanField
|
|
219
|
+
name="checked"
|
|
220
|
+
description="Check this box to mark the todo as completed"
|
|
221
|
+
value={value}
|
|
222
|
+
onChange={onChange}
|
|
223
|
+
/>
|
|
224
|
+
</Form>
|
|
225
|
+
);
|
|
226
|
+
};
|
|
227
|
+
```
|
|
228
|
+
</details>
|
|
229
|
+
|
|
230
|
+
<details>
|
|
231
|
+
<summary>Inputfield</summary>
|
|
232
|
+
```typescript
|
|
233
|
+
import { Form, StringField } from "@powerhousedao/design-system/scalars";
|
|
234
|
+
|
|
235
|
+
interface InputFieldProps {
|
|
236
|
+
input: string;
|
|
237
|
+
value: string;
|
|
238
|
+
label?: string;
|
|
239
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
240
|
+
handleInputChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export const InputField = (props: InputFieldProps) => {
|
|
244
|
+
const { input, value, label, onKeyDown, handleInputChange } = props;
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
<Form
|
|
248
|
+
defaultValues={{
|
|
249
|
+
input: input,
|
|
250
|
+
}}
|
|
251
|
+
onSubmit={() => {}}
|
|
252
|
+
resetOnSuccessfulSubmit
|
|
253
|
+
>
|
|
254
|
+
<StringField
|
|
255
|
+
style={{
|
|
256
|
+
color: "black",
|
|
257
|
+
}}
|
|
258
|
+
label={label}
|
|
259
|
+
name="input"
|
|
260
|
+
value={value}
|
|
261
|
+
onKeyDown={onKeyDown}
|
|
262
|
+
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
263
|
+
handleInputChange(e);
|
|
264
|
+
}}
|
|
265
|
+
/>
|
|
266
|
+
</Form>
|
|
267
|
+
);
|
|
268
|
+
};
|
|
269
|
+
```
|
|
270
|
+
</details>
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
Below is the complete code for the To-do List editor, primarily using Tailwind CSS for styling and importing the components from the Powerhouse Design System.
|
|
274
|
+
|
|
275
|
+
<details>
|
|
276
|
+
<summary>Complete To-do-list Editor Example (using Tailwind CSS)</summary>
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
// Import necessary types and components.
|
|
280
|
+
import { EditorProps } from 'document-model'; // Core type for editor components.
|
|
281
|
+
import {
|
|
282
|
+
ToDoListState, // Type for the global state of the ToDoList.
|
|
283
|
+
ToDoListAction, // Type for actions that can modify the ToDoList state.
|
|
284
|
+
ToDoListLocalState, // Type for local (non-shared) editor state (if needed).
|
|
285
|
+
ToDoItem, // Type for a single item in the list.
|
|
286
|
+
actions, // Object containing action creators for dispatching changes.
|
|
287
|
+
ToDoListDocument // The complete document structure including state and metadata.
|
|
288
|
+
} from '../../document-models/to-do-list/index.js'; // Path to your document model definition.
|
|
289
|
+
import { useState } from 'react'; // React hook for managing component-local state.
|
|
290
|
+
import { Checkbox } from './components/checkbox.js'; // Custom Checkbox component.
|
|
291
|
+
import { InputField } from './components/inputField.js'; // Custom InputField component.
|
|
292
|
+
|
|
293
|
+
// Define the props expected by this Editor component. It extends EditorProps with our specific document type.
|
|
294
|
+
export type IProps = EditorProps<ToDoListDocument>;
|
|
295
|
+
|
|
296
|
+
// Define the main Editor component function.
|
|
297
|
+
export default function Editor(props: IProps) {
|
|
298
|
+
// Destructure props for easier access.
|
|
299
|
+
const { document, dispatch } = props;
|
|
300
|
+
// Access the global state from the document object.
|
|
301
|
+
const { state: { global: state } } = document;
|
|
302
|
+
|
|
303
|
+
// --- Component State ---
|
|
304
|
+
// State for the text input field where new tasks are typed.
|
|
305
|
+
const [todoItem, setTodoItem] = useState('');
|
|
306
|
+
// State to track which item is currently being edited (null if none). Stores the item's ID.
|
|
307
|
+
const [editingItemId, setEditingItemId] = useState<string | null>(null);
|
|
308
|
+
// State to hold the text of the item currently being edited.
|
|
309
|
+
const [editedText, setEditedText] = useState('');
|
|
310
|
+
|
|
311
|
+
// --- JSX Structure (What gets rendered) ---
|
|
312
|
+
return (
|
|
313
|
+
// Main container div.
|
|
314
|
+
// `container`: Sets max-width based on viewport breakpoints.
|
|
315
|
+
// `mx-auto`: Centers the container horizontally.
|
|
316
|
+
// `p-4`: Adds padding on all sides (4 units, typically 1rem).
|
|
317
|
+
// `max-w-md`: Sets a maximum width (medium size).
|
|
318
|
+
<div className="container mx-auto p-4 max-w-md">
|
|
319
|
+
{/* Heading for the editor */}
|
|
320
|
+
{/* `text-2xl`: Sets font size to extra-large. */}
|
|
321
|
+
{/* `font-bold`: Makes the text bold. */}
|
|
322
|
+
{/* `mb-4`: Adds margin to the bottom (4 units). */}
|
|
323
|
+
<h1 className="text-2xl font-bold mb-4">To-do List</h1>
|
|
324
|
+
|
|
325
|
+
{/* Container for the input field and "Add" button */}
|
|
326
|
+
{/* `flex items-end`: Enables flexbox layout for children with bottom alignment. */}
|
|
327
|
+
{/* `gap-2`: Adds a small gap between flex items. */}
|
|
328
|
+
{/* `mb-4`: Adds margin to the bottom. */}
|
|
329
|
+
<div className="flex items-end gap-2 mb-4">
|
|
330
|
+
{/* Custom InputField component */}
|
|
331
|
+
<InputField
|
|
332
|
+
label="New Task" // Prop for accessibility/placeholder.
|
|
333
|
+
input={todoItem} // Current value from state.
|
|
334
|
+
value={todoItem} // Controlled component value.
|
|
335
|
+
handleInputChange={(e) => setTodoItem(e.target.value)} // Update state on change.
|
|
336
|
+
onKeyDown={(e) => { // Handle "Enter" key press to add item.
|
|
337
|
+
if (e.key === 'Enter' && todoItem.trim()) { // Check if key is Enter and input is not empty
|
|
338
|
+
dispatch(actions.addTodoItem({ // Dispatch action to add item.
|
|
339
|
+
id: Math.random().toString(), // Generate a simple unique ID (use a better method in production!).
|
|
340
|
+
text: todoItem,
|
|
341
|
+
}));
|
|
342
|
+
setTodoItem(''); // Clear the input field.
|
|
343
|
+
}
|
|
344
|
+
}}
|
|
345
|
+
/>
|
|
346
|
+
{/* "Add" button */}
|
|
347
|
+
{/* `bg-blue-500`: Sets background color to blue. */}
|
|
348
|
+
{/* `hover:bg-blue-600`: Changes background color on hover. */}
|
|
349
|
+
{/* `text-white`: Sets text color to white. */}
|
|
350
|
+
{/* `px-4`: Adds horizontal padding (4 units). */}
|
|
351
|
+
{/* `py-1.5`: Adds vertical padding (1.5 units). */}
|
|
352
|
+
{/* `rounded`: Applies rounded corners. */}
|
|
353
|
+
{/* `transition-colors`: Smoothly animates color changes. */}
|
|
354
|
+
<button
|
|
355
|
+
className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-1.5 rounded transition-colors"
|
|
356
|
+
onClick={() => { // Handle button click to add item.
|
|
357
|
+
if (todoItem.trim()) { // Check if input is not empty
|
|
358
|
+
dispatch(actions.addTodoItem({ // Dispatch action to add item.
|
|
359
|
+
id: Math.random().toString(), // Simple unique ID.
|
|
360
|
+
text: todoItem,
|
|
361
|
+
}));
|
|
362
|
+
setTodoItem(''); // Clear the input field.
|
|
363
|
+
}
|
|
364
|
+
}}
|
|
365
|
+
>
|
|
366
|
+
Add
|
|
367
|
+
</button>
|
|
368
|
+
</div>
|
|
369
|
+
|
|
370
|
+
{/* Unordered list to display the to-do items */}
|
|
371
|
+
{/* `list-none`: Removes default list bullet points. */}
|
|
372
|
+
{/* `p-0`: Removes default padding. */}
|
|
373
|
+
<ul className="list-none p-0">
|
|
374
|
+
{/* Map over the items array in the global state to render each item */}
|
|
375
|
+
{state.items.map((item: ToDoItem) => (
|
|
376
|
+
// List item element for each to-do.
|
|
377
|
+
// `key={item.id}`: React requires a unique key for list items for efficient updates.
|
|
378
|
+
// `flex`: Enables flexbox layout (checkbox, text, delete icon in a row).
|
|
379
|
+
// `items-center`: Aligns items vertically in the center.
|
|
380
|
+
// `p-2`: Adds padding.
|
|
381
|
+
// `relative`: Needed for positioning the delete icon absolutely (if we were doing that).
|
|
382
|
+
// `border-b`: Adds a bottom border.
|
|
383
|
+
// `border-gray-100`: Sets border color to light gray.
|
|
384
|
+
<li
|
|
385
|
+
key={item.id}
|
|
386
|
+
className="flex items-center p-2 relative border-b border-gray-100"
|
|
387
|
+
>
|
|
388
|
+
{/* Custom Checkbox component */}
|
|
389
|
+
<Checkbox
|
|
390
|
+
value={item.checked} // Bind checked state to item's checked property.
|
|
391
|
+
onChange={() => { // Handle checkbox click.
|
|
392
|
+
dispatch(actions.updateTodoItem({ // Dispatch action to update item.
|
|
393
|
+
id: item.id,
|
|
394
|
+
checked: !item.checked, // Toggle the checked state.
|
|
395
|
+
}));
|
|
396
|
+
}}
|
|
397
|
+
/>
|
|
398
|
+
|
|
399
|
+
{/* Conditional Rendering: Show input field or text based on editing state */}
|
|
400
|
+
{editingItemId === item.id ? (
|
|
401
|
+
// --- Editing State ---
|
|
402
|
+
// Input field shown when this item is being edited.
|
|
403
|
+
// `ml-2`: Adds left margin.
|
|
404
|
+
// `flex-grow`: Allows input to take available horizontal space.
|
|
405
|
+
// `p-1`: Adds small padding.
|
|
406
|
+
// `border`: Adds a default border.
|
|
407
|
+
// `rounded`: Applies rounded corners.
|
|
408
|
+
// `focus:outline-none`: Removes the default browser focus outline.
|
|
409
|
+
// `focus:ring-1 focus:ring-blue-500`: Adds a custom blue ring when focused.
|
|
410
|
+
<input
|
|
411
|
+
className="ml-2 flex-grow p-1 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500"
|
|
412
|
+
value={editedText} // Controlled input value from editedText state.
|
|
413
|
+
onChange={(e) => setEditedText(e.target.value)} // Update editedText state.
|
|
414
|
+
onKeyDown={(e) => { // Handle "Enter" key to save changes.
|
|
415
|
+
if (e.key === 'Enter') {
|
|
416
|
+
dispatch(actions.updateTodoItem({ // Dispatch update action.
|
|
417
|
+
id: item.id,
|
|
418
|
+
text: editedText, // Save the edited text.
|
|
419
|
+
}));
|
|
420
|
+
setEditingItemId(null); // Exit editing mode.
|
|
421
|
+
}
|
|
422
|
+
}}
|
|
423
|
+
autoFocus // Automatically focus the input when it appears.
|
|
424
|
+
/>
|
|
425
|
+
) : (
|
|
426
|
+
// --- Display State ---
|
|
427
|
+
// Container for the item text and delete icon when not editing.
|
|
428
|
+
// `ml-2`: Adds left margin.
|
|
429
|
+
// `flex items-center`: Aligns text and icon vertically.
|
|
430
|
+
// `flex-grow`: Allows this container to take available space.
|
|
431
|
+
// `gap-1`: Adds a small gap between text and icon.
|
|
432
|
+
<div className="ml-2 flex items-center flex-grow gap-1">
|
|
433
|
+
{/* The actual to-do item text */}
|
|
434
|
+
{/* `cursor-pointer`: Shows a pointer cursor on hover, indicating clickability. */}
|
|
435
|
+
{/* Conditional class: Apply line-through and gray text if item is checked. */}
|
|
436
|
+
{/* `line-through`: Strikes through the text. */}
|
|
437
|
+
{/* `text-gray-500`: Sets text color to gray. */}
|
|
438
|
+
<span
|
|
439
|
+
className={`cursor-pointer ${item.checked ? 'line-through text-gray-500' : ''}`}
|
|
440
|
+
onClick={() => { // Handle click to enter editing mode.
|
|
441
|
+
setEditingItemId(item.id); // Set the ID of the item being edited.
|
|
442
|
+
setEditedText(item.text); // Initialize the input with current text.
|
|
443
|
+
}}
|
|
444
|
+
>
|
|
445
|
+
{item.text} {/* Display the item's text */}
|
|
446
|
+
</span>
|
|
447
|
+
{/* Delete "button" (using a span styled as a button) */}
|
|
448
|
+
{/* `text-gray-400`: Sets default text color to light gray. */}
|
|
449
|
+
{/* `cursor-pointer`: Shows pointer cursor. */}
|
|
450
|
+
{/* `opacity-40`: Makes it semi-transparent by default. */}
|
|
451
|
+
{/* `transition-all duration-200`: Smoothly animates all changes (opacity, color). */}
|
|
452
|
+
{/* `text-base font-bold`: Sets text size and weight. */}
|
|
453
|
+
{/* `inline-flex items-center`: Needed for proper alignment if using an icon font/SVG. */}
|
|
454
|
+
{/* `pl-1`: Adds small left padding. */}
|
|
455
|
+
{/* `hover:opacity-100`: Makes it fully opaque on hover. */}
|
|
456
|
+
{/* `hover:text-red-500`: Changes text color to red on hover. */}
|
|
457
|
+
<span
|
|
458
|
+
className="text-gray-400 cursor-pointer opacity-40 transition-all duration-200 text-base font-bold inline-flex items-center pl-1 hover:opacity-100 hover:text-red-500"
|
|
459
|
+
onClick={() => dispatch(actions.deleteTodoItem({ id: item.id }))} // Dispatch delete action on click.
|
|
460
|
+
>
|
|
461
|
+
× {/* Simple multiplication sign used as delete icon */}
|
|
462
|
+
</span>
|
|
463
|
+
</div>
|
|
464
|
+
)}
|
|
465
|
+
</li>
|
|
466
|
+
))}
|
|
467
|
+
</ul>
|
|
468
|
+
</div>
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
</details>
|
|
473
|
+
|
|
474
|
+
Now you can run the Connect app and see the **ToDoList** editor in action.
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
ph connect
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
In Connect, in the bottom right corner you'll find a new Document Model that you can create: **ToDoList**.
|
|
481
|
+
Click on it to create a new ToDoList document.
|
|
482
|
+
|
|
483
|
+
:::info
|
|
484
|
+
The editor will update dynamically, so you can play around with your editor styling while seeing your results appear in Connect Studio.
|
|
485
|
+
:::
|
|
486
|
+
|
|
487
|
+
Congratulations!
|
|
488
|
+
If you managed to follow this tutorial until this point, you have successfully implemented the **ToDoList** document model with its reducer operations and editor.
|
|
489
|
+
|
|
490
|
+
Now you can move on to creating a [custom drive explorer](/docs/academy/AdvancedTutorial/BuildingUserExperiences/BuildingADriveExplorer) for your ToDoList document.
|
|
491
|
+
Imagine you have many ToDoLists sitting in a drive. A custom drive explorer will allow you to organize and track them at a glance, opening up a new world of possibilities to increase the functionality of your documents!
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
.titleContainer {
|
|
2
|
+
text-align: center;
|
|
3
|
+
margin-bottom: 2rem;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.titleContainer h1 {
|
|
7
|
+
font-size: 2.5rem;
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.learningPath {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: repeat(3, 1fr);
|
|
14
|
+
gap: 2rem;
|
|
15
|
+
max-width: 1200px;
|
|
16
|
+
margin: 0 auto;
|
|
17
|
+
padding: 2rem;
|
|
18
|
+
width: 100%;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.fullWidth {
|
|
23
|
+
grid-column: 1 / -1;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.pathCard {
|
|
28
|
+
background: white;
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
padding: 1.5rem;
|
|
31
|
+
border: 1px solid #e5e7eb;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.cardContent {
|
|
35
|
+
height: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.buttonContainer {
|
|
39
|
+
display: grid;
|
|
40
|
+
grid-template-columns: repeat(3, 1fr);
|
|
41
|
+
gap: 2rem;
|
|
42
|
+
margin-top: 1rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.titleIcon {
|
|
46
|
+
width: 24px;
|
|
47
|
+
height: 24px;
|
|
48
|
+
margin-right: 0.75rem;
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.cardHeader {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
margin-bottom: 1rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.cardIconWrapper {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
width: 20px;
|
|
63
|
+
height: 20px;
|
|
64
|
+
margin-right: 0.75rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:global(.card-title) {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: flex-start;
|
|
71
|
+
margin: 0;
|
|
72
|
+
padding: 0;
|
|
73
|
+
font-size: 1.25rem;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
line-height: 1.2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:global(.card-title img) {
|
|
79
|
+
display: inline-flex;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:global(.path-button) {
|
|
83
|
+
display: block;
|
|
84
|
+
text-decoration: none;
|
|
85
|
+
padding: 1rem;
|
|
86
|
+
margin: 0.5rem 0;
|
|
87
|
+
border-radius: 8px;
|
|
88
|
+
background: #f3f4f6;
|
|
89
|
+
border: 0px solid #e5e7eb;
|
|
90
|
+
color: #111827;
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
text-align: center;
|
|
93
|
+
transition: background 0.2s ease-in-out;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:global(.path-button:hover) {
|
|
97
|
+
background: #ffffff;
|
|
98
|
+
border-color: #d1d5db;
|
|
99
|
+
}
|