Skip to content

Commit

Permalink
made SPOCBoxedTextWithIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorKalvoda committed Jun 19, 2024
1 parent fdd74e1 commit 791e62c
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 26 deletions.
37 changes: 37 additions & 0 deletions src/SpotifyConnect/SPOCBoxedTextWithIcon.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Class {
#name : #SPOCBoxedTextWithIcon,
#superclass : #SPOCBoxedText,
#category : #'SpotifyConnect-UI'
}

{
#category : #constructor,
#'squeak_changestamp' : 'VK 6/19/2024 16:21'
}
SPOCBoxedTextWithIcon class >> newWithText: aString withIcon: anAssetPath [

| text |
text := SPOCBoxedTextWithIcon new contents: aString;
position: SPOCStyle iconPadding @ 0;
withAssetPath: anAssetPath;
yourself.
^ text
]

{
#category : #initialization,
#'squeak_changestamp' : 'VK 6/19/2024 16:23'
}
SPOCBoxedTextWithIcon >> initialize [

super initialize.
]

{
#category : #accessing,
#'squeak_changestamp' : 'VK 6/19/2024 16:27'
}
SPOCBoxedTextWithIcon >> withAssetPath: anAssetPath [

self addMorph: (SPOCIcon new iconAsset: anAssetPath)
]
19 changes: 12 additions & 7 deletions src/SpotifyConnect/SPOCRecentlyPlayed.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ SPOCRecentlyPlayed class >> beforeTimestamp [
^ DateAndTime current asUnixTime * 1000
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'VK 6/19/2024 16:32'
}
SPOCRecentlyPlayed class >> recentlyPlayedIconPath [

^ '/assets/recently-played.png'
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'VK 6/1/2024 22:08'
Expand All @@ -37,18 +46,14 @@ SPOCRecentlyPlayed class >> trackLimit [

{
#category : #building,
#'squeak_changestamp' : 'VE 6/10/2024 22:07'
#'squeak_changestamp' : 'VK 6/19/2024 16:33'
}
SPOCRecentlyPlayed >> buildButton [

| text icon button |
text := (SPOCBoxedText new contents: ' Recently Played';
position: SPOCStyle recentlyPlayedPadding@0;
yourself).
icon := SPOCIcon new iconAsset: '/assets/recently-played.png'.
| text button |
text := SPOCBoxedTextWithIcon newWithText: ' Recently Played' withIcon: self class recentlyPlayedIconPath.
button := Morph new color: Color transparent;
addMorph: text;
addMorph: icon;
yourself.
button extent: 0@0;
extent: button fullBounds extent.
Expand Down
9 changes: 9 additions & 0 deletions src/SpotifyConnect/SPOCStyle.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ SPOCStyle class >> gitRepoName [
^ 'SpotifyConnect'
]

{
#category : #'class variables',
#'squeak_changestamp' : 'VK 6/19/2024 16:07'
}
SPOCStyle class >> iconPadding [

^ 8
]

{
#category : #'class variables',
#'squeak_changestamp' : 'RK 6/9/2024 14:44'
Expand Down
21 changes: 2 additions & 19 deletions src/SpotifyConnect/SPOCSwitchDevice.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,12 @@ SPOCSwitchDevice class >> itemTextPadding [

{
#category : #building,
#'squeak_changestamp' : 'TL 6/17/2024 20:23'
#'squeak_changestamp' : 'VK 6/19/2024 16:31'
}
SPOCSwitchDevice >> attachButton [

| button |
button := Morph new
color: Color transparent;
addMorph: self buttonText;
addMorph: (SPOCIcon new iconAsset: self class devicesIconPath);
yourself.
button extent: 0@0;
extent: button fullBounds extent.
button := SPOCBoxedTextWithIcon newWithText: ' Devices' withIcon: self class devicesIconPath.
self addMorph: (SPOCClickable newUsing: button onClick: [:anEvent | self buttonClicked])

]
Expand Down Expand Up @@ -130,17 +124,6 @@ SPOCSwitchDevice >> buttonClicked [
ifFalse: [self currentDevices]]
]

{
#category : #building,
#'squeak_changestamp' : 'VK 6/10/2024 19:10'
}
SPOCSwitchDevice >> buttonText [

^ (SPOCBoxedText new contents: ' Devices';
position: SPOCStyle devicesTextPadding@0;
yourself).
]

{
#category : #'api-call',
#'squeak_changestamp' : 'TL 6/17/2024 20:29'
Expand Down

0 comments on commit 791e62c

Please sign in to comment.