diff --git a/src/TinyBlog/TBApplicationRootComponent.class.st b/src/TinyBlog/TBApplicationRootComponent.class.st new file mode 100644 index 0000000..f22a14b --- /dev/null +++ b/src/TinyBlog/TBApplicationRootComponent.class.st @@ -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' +] diff --git a/src/TinyBlog/TBHeaderComponent.class.st b/src/TinyBlog/TBHeaderComponent.class.st new file mode 100644 index 0000000..5d9d187 --- /dev/null +++ b/src/TinyBlog/TBHeaderComponent.class.st @@ -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 + ] + ] +] diff --git a/src/TinyBlog/TBScreenComponent.class.st b/src/TinyBlog/TBScreenComponent.class.st new file mode 100644 index 0000000..2d131e8 --- /dev/null +++ b/src/TinyBlog/TBScreenComponent.class.st @@ -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 +]