Skip to content

Commit 20b6d95

Browse files
authored
Merge pull request #7160 from nextcloud-libraries/doc/guest-content
docs: clarify application containers and especially NcGuestContent
2 parents 9faa7c0 + b5942a2 commit 20b6d95

File tree

3 files changed

+72
-32
lines changed

3 files changed

+72
-32
lines changed

docs/app-containers.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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** 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 for all apps that provide full web-page interface.
12+
Its usual usage looks like this:
13+
14+
```html static
15+
<NcContent>
16+
<NcAppNavigation>
17+
<!--- any in-app navigation -->
18+
</NcAppNavigation>
19+
<NcAppContent>
20+
<!-- you application content -->
21+
</NcAppContent>
22+
</NcContent>
23+
```
24+
25+
#### `NcGuestContent`
26+
This is the main container for guest content like the login box of Nextcloud.
27+
It should only be used as the main container when rendering a page as `OCP\AppFramework\Http\TemplateResponse::RENDER_AS_GUEST`.
28+
29+
<!-- 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+
```html 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: 38 additions & 30 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,54 @@ 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',
209+
content: 'docs/app-containers.md',
216210
components: [
217-
'src/components/NcAppContent/NcAppContent.vue',
218211
'src/components/NcContent/NcContent.vue',
212+
'src/components/NcGuestContent/NcGuestContent.vue',
219213
],
220214
sections: [
221215
{
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-
],
230-
},
231-
{
232-
name: 'NcAppSidebar',
233-
components: [
234-
'src/components/NcAppSidebar/NcAppSidebar.vue',
235-
'src/components/NcAppSidebarHeader/NcAppSidebarHeader.vue',
236-
'src/components/NcAppSidebarTab/NcAppSidebarTab.vue',
237-
],
238-
},
239-
{
240-
name: 'NcAppSettings',
241-
components: [
242-
'src/components/NcAppSettings*/*.vue',
216+
name: 'NcAppContent',
217+
components: 'src/components/NcAppContent/NcAppContent.vue',
218+
sections: [
219+
{
220+
name: 'NcAppNavigation',
221+
components: [
222+
'src/components/NcAppNavigation*/*.vue',
223+
],
224+
ignore: [
225+
'src/components/NcAppNavigationItem/NcAppNavigationIconCollapsible.vue',
226+
'src/components/NcAppNavigationItem/NcInputConfirmCancel.vue',
227+
],
228+
},
229+
{
230+
name: 'NcAppSidebar',
231+
components: [
232+
'src/components/NcAppSidebar/NcAppSidebar.vue',
233+
'src/components/NcAppSidebarHeader/NcAppSidebarHeader.vue',
234+
'src/components/NcAppSidebarTab/NcAppSidebarTab.vue',
235+
],
236+
},
237+
{
238+
name: 'NcAppSettings',
239+
components: [
240+
'src/components/NcAppSettings*/*.vue',
241+
],
242+
},
243243
],
244244
},
245245
],
246246
},
247+
{
248+
name: 'NcActions',
249+
components: [
250+
// Put Actions component first
251+
'src/components/NcActions/*.vue',
252+
'src/components/NcAction[A-Z]*/*.vue',
253+
],
254+
},
247255
{
248256
name: 'NcBreadcrumbs',
249257
components: [

0 commit comments

Comments
 (0)