Add root components

This commit is contained in:
2025-09-19 22:31:06 +02:00
parent b4338da214
commit 7432a46ae2
3 changed files with 106 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
Class {
#name : #TBApplicationRootComponent,
#superclass : #WAComponent,
#instVars : [
'main'
],
#category : #'TinyBlog-Components'
}
{ #category : #testing }
TBApplicationRootComponent class >> canBeRoot [
^ true
]
{ #category : #initialization }
TBApplicationRootComponent class >> initialize [
"self initialize"
| app |
app := WAAdmin register: self asApplicationAt: 'TinyBlog'.
app
addLibrary: JQDeploymentLibrary;
addLibrary: JQUiDeploymentLibrary;
addLibrary: SBSDeploymentLibrary
]
{ #category : #rendering }
TBApplicationRootComponent >> children [
^ { main }
]
{ #category : #initialization }
TBApplicationRootComponent >> initialize [
super initialize.
main := TBScreenComponent new
]
{ #category : #rendering }
TBApplicationRootComponent >> renderContentOn: html [
html render: main
]
{ #category : #rendering }
TBApplicationRootComponent >> updateRoot: anHtmlRoot [
super updateRoot: anHtmlRoot.
anHtmlRoot beHtml5.
anHtmlRoot title: 'TinyBlog'
]

View File

@@ -0,0 +1,23 @@
Class {
#name : #TBHeaderComponent,
#superclass : #WAComponent,
#category : #'TinyBlog-Components'
}
{ #category : #rendering }
TBHeaderComponent >> renderBrandOn: html [
html tbsNavbarHeader: [
html tbsNavbarBrand
url: self application url;
with: 'TinyBlog'
]
]
{ #category : #rendering }
TBHeaderComponent >> renderContentOn: html [
html tbsNavbar beDefault; with: [
html tbsContainer: [
self renderBrandOn: html
]
]
]

View File

@@ -0,0 +1,36 @@
Class {
#name : #TBScreenComponent,
#superclass : #WAComponent,
#instVars : [
'header'
],
#category : #'TinyBlog-Components'
}
{ #category : #acccessing }
TBScreenComponent >> blog [
"Return the current blog. In the future we will ask the
session to return the blog of the currently logged in user."
^ TBBlog current
]
{ #category : #acccessing }
TBScreenComponent >> children [
^ { header }
]
{ #category : #initialization }
TBScreenComponent >> createHeaderComponent [
^ TBHeaderComponent new
]
{ #category : #initialization }
TBScreenComponent >> initialize [
super initialize.
header := self createHeaderComponent
]
{ #category : #acccessing }
TBScreenComponent >> renderContentOn: html [
html render: header
]