Skip to content

Commit 174f45a

Browse files
committed
docs: clarify application containers and especially NcGuestContent
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 4befd73 commit 174f45a

File tree

3 files changed

+64
-31
lines changed

3 files changed

+64
-31
lines changed

docs/app-containers.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!--
2+
- SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3+
- SPDX-License-Identifier: AGPL-3.0-or-later
4+
-->
5+
6+
All applications must to be wrapped in one of the provided app containers.
7+
Those containers provide base styling and context for all components.
8+
9+
### Available containers
10+
#### `NcContent`
11+
This is the main container useable for all apps that provide app content.
12+
Often you would use then `NcAppContent` and maybe `NcAppNavigation` within it.
13+
14+
#### `NcGuestContent`
15+
This is the main container for guest content like the login box of Nextcloud.
16+
It should only be used as the main container when rendering a page as `OCP\AppFramework\Http\TemplateResponse::RENDER_AS_GUEST`.
17+
18+
<!-- TODO: Missing container for settings -->

src/components/NcGuestContent/NcGuestContent.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
Guest content container to be used for the guest content of your app.
99

1010
This components provides a wrapper around guest page content.
11-
It should be used as the main wrapper for public pages, similar to `NcContent`.
11+
It should be used as the main wrapper for guest pages, similar to `NcContent` for public and user pages.
12+
Meaning this component must be used as the root component for your application
13+
if you render the page using `OCP\AppFramework\Http\TemplateResponse::RENDER_AS_GUEST`.
1214

1315
It can't be used multiple times on the same page.
1416

1517
### Usage
1618

17-
```vue
19+
```vue static
1820
<template>
1921
<NcGuestContent>
2022
<h2>Hello guest</h2>
@@ -26,6 +28,7 @@ It can't be used multiple times on the same page.
2628

2729
<script setup lang="ts">
2830
import type { Slot } from 'vue'
31+
2932
import { onMounted, onUnmounted } from 'vue'
3033
3134
defineSlots<{

styleguide.config.cjs

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ module.exports = async () => {
192192
'src/components/NcDashboard*/*.vue',
193193
'src/components/NcDialog*/*.vue',
194194
'src/components/NcEllipsisedOption*/*.vue',
195+
'src/components/NcGuestContent/*.vue',
195196
'src/components/NcHeader*/*.vue',
196197
'src/components/NcListItem*/*.vue',
197198
'src/components/NcPopover/NcPopoverTriggerProvider.vue',
@@ -203,47 +204,58 @@ module.exports = async () => {
203204
'src/components/NcUserBubble/NcUserBubbleDiv.vue',
204205
],
205206
sections: [
206-
{
207-
name: 'NcActions',
208-
components: [
209-
// Put Actions component first
210-
'src/components/NcActions/*.vue',
211-
'src/components/NcAction[A-Z]*/*.vue',
212-
],
213-
},
214207
{
215208
name: 'App containers',
216-
components: [
217-
'src/components/NcAppContent/NcAppContent.vue',
218-
'src/components/NcContent/NcContent.vue',
219-
],
209+
content: 'docs/app-containers.md',
220210
sections: [
221211
{
222-
name: 'NcAppNavigation',
223-
components: [
224-
'src/components/NcAppNavigation*/*.vue',
225-
],
226-
ignore: [
227-
'src/components/NcAppNavigationItem/NcAppNavigationIconCollapsible.vue',
228-
'src/components/NcAppNavigationItem/NcInputConfirmCancel.vue',
229-
],
212+
name: 'NcContent',
213+
components: 'src/components/NcContent/NcContent.vue',
230214
},
231215
{
232-
name: 'NcAppSidebar',
233-
components: [
234-
'src/components/NcAppSidebar/NcAppSidebar.vue',
235-
'src/components/NcAppSidebarHeader/NcAppSidebarHeader.vue',
236-
'src/components/NcAppSidebarTab/NcAppSidebarTab.vue',
237-
],
216+
name: 'NcGuestContent',
217+
components: 'src/components/NcGuestContent/NcGuestContent.vue',
238218
},
239219
{
240-
name: 'NcAppSettings',
241-
components: [
242-
'src/components/NcAppSettings*/*.vue',
220+
name: 'NcAppContent',
221+
components: 'src/components/NcAppContent/NcAppContent.vue',
222+
sections: [
223+
{
224+
name: 'NcAppNavigation',
225+
components: [
226+
'src/components/NcAppNavigation*/*.vue',
227+
],
228+
ignore: [
229+
'src/components/NcAppNavigationItem/NcAppNavigationIconCollapsible.vue',
230+
'src/components/NcAppNavigationItem/NcInputConfirmCancel.vue',
231+
],
232+
},
233+
{
234+
name: 'NcAppSidebar',
235+
components: [
236+
'src/components/NcAppSidebar/NcAppSidebar.vue',
237+
'src/components/NcAppSidebarHeader/NcAppSidebarHeader.vue',
238+
'src/components/NcAppSidebarTab/NcAppSidebarTab.vue',
239+
],
240+
},
241+
{
242+
name: 'NcAppSettings',
243+
components: [
244+
'src/components/NcAppSettings*/*.vue',
245+
],
246+
},
243247
],
244248
},
245249
],
246250
},
251+
{
252+
name: 'NcActions',
253+
components: [
254+
// Put Actions component first
255+
'src/components/NcActions/*.vue',
256+
'src/components/NcAction[A-Z]*/*.vue',
257+
],
258+
},
247259
{
248260
name: 'NcBreadcrumbs',
249261
components: [

0 commit comments

Comments
 (0)