Skip to content

Commit

Permalink
landing page refactoring & Stylesheet class
Browse files Browse the repository at this point in the history
  • Loading branch information
linuskoester committed Jul 4, 2024
1 parent c37d3a5 commit e51e8ce
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 54 deletions.
8 changes: 4 additions & 4 deletions src/SqueakKara-Core/SKGrid.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ SKGrid >> addVerticalLineAt: aCoordinate [

{
#category : #texture,
#'squeak_changestamp' : 'JJG 6/12/2024 16:45'
#'squeak_changestamp' : 'LK 7/4/2024 19:10'
}
SKGrid >> backgroundColor [

^ Color lightGreen lighter
^ SKStylesheet primaryColor
]

{
Expand Down Expand Up @@ -271,11 +271,11 @@ SKGrid >> isPointInGridDimensions: aPoint [

{
#category : #texture,
#'squeak_changestamp' : 'JJG 6/12/2024 16:45'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKGrid >> lineColor [

^ Color gray lighter
^ SKStylesheet secondaryColor


]
Expand Down
62 changes: 39 additions & 23 deletions src/SqueakKara-Core/SKLandingPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SKLandingPage >> addAllButtons [

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 22:52'
#'squeak_changestamp' : 'LK 7/4/2024 19:01'
}
SKLandingPage >> addButton: aButton atIndex: anInteger [

Expand All @@ -73,58 +73,65 @@ SKLandingPage >> addButton: aButton atIndex: anInteger [

anOffset := 2 * aButton height * anInteger.

aButton position: self center - (aButton width / 2) + (0 @ anOffset).
aButton position: self center - (aButton width / 2) + (0 @ anOffset)
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 23:02'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKLandingPage >> buildButtonExample1 [

^ SimpleButtonMorph new
label: self buttonExample1Label;
target: self;
actionSelector: #actionExample1;
color: Color lightGray
^ self buildButtonWithLabel: self buttonExample1Label
andSelector: #actionExample1
andColor: SKStylesheet secondaryColor
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 23:02'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKLandingPage >> buildButtonExample2 [

^ SimpleButtonMorph new
label: self buttonExample2Label;
target: self;
actionSelector: #actionExample2;
color: Color lightGray
^ self buildButtonWithLabel: self buttonExample2Label
andSelector: #actionExample2
andColor: SKStylesheet secondaryColor
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 23:02'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKLandingPage >> buildButtonExample3 [

^ SimpleButtonMorph new
label: self buttonExample3Label;
target: self;
actionSelector: #actionExample3;
color: Color lightGray
^ self buildButtonWithLabel: self buttonExample3Label
andSelector: #actionExample3
andColor: SKStylesheet secondaryColor
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 23:01'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKLandingPage >> buildButtonNew [

^ self buildButtonWithLabel: self buttonNewLabel
andSelector: #actionNew
andColor: SKStylesheet primaryColor
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 7/4/2024 19:07'
}
SKLandingPage >> buildButtonWithLabel: aLabel andSelector: aSelector andColor: aColor [

^ SimpleButtonMorph new
label: self buttonNewLabel;
label: aLabel;
target: self;
actionSelector: #actionNew.
actionSelector: aSelector;
color: aColor;
height: self buttonHeight
]

{
Expand Down Expand Up @@ -154,6 +161,15 @@ SKLandingPage >> buttonExample3Label [
^ 'Example Project 3'
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 7/4/2024 19:06'
}
SKLandingPage >> buttonHeight [

^ 20 px
]

{
#category : #labels,
#'squeak_changestamp' : 'LK 6/21/2024 22:52'
Expand Down
27 changes: 27 additions & 0 deletions src/SqueakKara-Core/SKStylesheet.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"
SKStylesheet provides access to common stylistic properties, e.g. primary and secondary colors.
"
Class {
#name : #SKStylesheet,
#superclass : #Object,
#category : #'SqueakKara-Core',
#'squeak_changestamp' : 'LK 7/4/2024 19:13'
}

{
#category : #colors,
#'squeak_changestamp' : 'LK 7/4/2024 19:11'
}
SKStylesheet class >> primaryColor [

^ Color lightGreen lighter
]

{
#category : #colors,
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKStylesheet class >> secondaryColor [

^ Color gray lighter
]
8 changes: 4 additions & 4 deletions src/SqueakKara/SKGrid.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ SKGrid >> addVerticalLineAt: aCoordinate [

{
#category : #texture,
#'squeak_changestamp' : 'JJG 6/12/2024 16:45'
#'squeak_changestamp' : 'LK 7/4/2024 19:10'
}
SKGrid >> backgroundColor [

^ Color lightGreen lighter
^ SKStylesheet primaryColor
]

{
Expand Down Expand Up @@ -271,11 +271,11 @@ SKGrid >> isPointInGridDimensions: aPoint [

{
#category : #texture,
#'squeak_changestamp' : 'JJG 6/12/2024 16:45'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKGrid >> lineColor [

^ Color gray lighter
^ SKStylesheet secondaryColor


]
Expand Down
62 changes: 39 additions & 23 deletions src/SqueakKara/SKLandingPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SKLandingPage >> addAllButtons [

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 22:52'
#'squeak_changestamp' : 'LK 7/4/2024 19:01'
}
SKLandingPage >> addButton: aButton atIndex: anInteger [

Expand All @@ -73,58 +73,65 @@ SKLandingPage >> addButton: aButton atIndex: anInteger [

anOffset := 2 * aButton height * anInteger.

aButton position: self center - (aButton width / 2) + (0 @ anOffset).
aButton position: self center - (aButton width / 2) + (0 @ anOffset)
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 23:02'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKLandingPage >> buildButtonExample1 [

^ SimpleButtonMorph new
label: self buttonExample1Label;
target: self;
actionSelector: #actionExample1;
color: Color lightGray
^ self buildButtonWithLabel: self buttonExample1Label
andSelector: #actionExample1
andColor: SKStylesheet secondaryColor
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 23:02'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKLandingPage >> buildButtonExample2 [

^ SimpleButtonMorph new
label: self buttonExample2Label;
target: self;
actionSelector: #actionExample2;
color: Color lightGray
^ self buildButtonWithLabel: self buttonExample2Label
andSelector: #actionExample2
andColor: SKStylesheet secondaryColor
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 23:02'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKLandingPage >> buildButtonExample3 [

^ SimpleButtonMorph new
label: self buttonExample3Label;
target: self;
actionSelector: #actionExample3;
color: Color lightGray
^ self buildButtonWithLabel: self buttonExample3Label
andSelector: #actionExample3
andColor: SKStylesheet secondaryColor
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 6/21/2024 23:01'
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKLandingPage >> buildButtonNew [

^ self buildButtonWithLabel: self buttonNewLabel
andSelector: #actionNew
andColor: SKStylesheet primaryColor
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 7/4/2024 19:07'
}
SKLandingPage >> buildButtonWithLabel: aLabel andSelector: aSelector andColor: aColor [

^ SimpleButtonMorph new
label: self buttonNewLabel;
label: aLabel;
target: self;
actionSelector: #actionNew.
actionSelector: aSelector;
color: aColor;
height: self buttonHeight
]

{
Expand Down Expand Up @@ -154,6 +161,15 @@ SKLandingPage >> buttonExample3Label [
^ 'Example Project 3'
]

{
#category : #buttons,
#'squeak_changestamp' : 'LK 7/4/2024 19:06'
}
SKLandingPage >> buttonHeight [

^ 20 px
]

{
#category : #labels,
#'squeak_changestamp' : 'LK 6/21/2024 22:52'
Expand Down
27 changes: 27 additions & 0 deletions src/SqueakKara/SKStylesheet.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"
SKStylesheet provides access to common stylistic properties, e.g. primary and secondary colors.
"
Class {
#name : #SKStylesheet,
#superclass : #Object,
#category : #'SqueakKara-Core',
#'squeak_changestamp' : 'LK 7/4/2024 19:13'
}

{
#category : #colors,
#'squeak_changestamp' : 'LK 7/4/2024 19:11'
}
SKStylesheet class >> primaryColor [

^ Color lightGreen lighter
]

{
#category : #colors,
#'squeak_changestamp' : 'LK 7/4/2024 19:12'
}
SKStylesheet class >> secondaryColor [

^ Color gray lighter
]

0 comments on commit e51e8ce

Please sign in to comment.