-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from sherpal/master
Publishing with *all* components implemented and demoed
- Loading branch information
Showing
204 changed files
with
6,303 additions
and
1,720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package demo | ||
|
||
import be.doeraene.webcomponents.ui5.* | ||
import be.doeraene.webcomponents.ui5.configkeys.* | ||
import com.raquo.laminar.api.L.* | ||
import demo.helpers.{DemoPanel, Example, FetchDemoPanelFromGithub} | ||
import org.scalajs.dom | ||
|
||
object AvatarGroupExample extends Example("AvatarGroup") { | ||
|
||
def component(using demoPanelInfoMap: FetchDemoPanelFromGithub.CompleteDemoPanelInfo): HtmlElement = div( | ||
DemoPanel("Avatar Group - type 'Individual'") { | ||
//-- Begin: Avatar Group - type 'Individual' | ||
AvatarGroup( | ||
_.tpe := AvatarGroupType.Individual, | ||
_ => IconName.allValues.take(5).map(icon => Avatar(_.icon := icon, _.size := AvatarSize.M)) | ||
) | ||
//-- End | ||
}, | ||
DemoPanel("Avatar Group - type 'Group'") { | ||
//-- Begin: Avatar Group - type 'Group' | ||
AvatarGroup( | ||
_.tpe := AvatarGroupType.Group, | ||
_ => IconName.allValues.take(5).map(icon => Avatar(_.icon := icon, _.size := AvatarSize.M)) | ||
) | ||
//-- End | ||
}, | ||
DemoPanel("Avatar Group with overflow") { | ||
//-- Begin: Avatar Group with overflow | ||
def allAvatars = IconName.allValues.take(10).map(icon => Avatar(_.icon := icon, _.size := AvatarSize.M)) | ||
|
||
val avatarsForPopoverBus: EventBus[List[HtmlElement]] = new EventBus | ||
val popoverOpenerBus: EventBus[dom.HTMLElement] = new EventBus | ||
|
||
div( | ||
AvatarGroup( | ||
_.tpe := AvatarGroupType.Individual, | ||
_ => allAvatars, | ||
_ => width := "400px", | ||
_.events.onClick.map(_.target.hiddenItems.length).map(allAvatars.takeRight) --> avatarsForPopoverBus.writer, | ||
_.events.onClick.filter(_.detail.overflowButtonClicked).map(_.detail.targetRef) --> popoverOpenerBus.writer | ||
), | ||
Popover( | ||
_.showAtFromEvents(popoverOpenerBus.events), | ||
_ => children <-- avatarsForPopoverBus | ||
) | ||
) | ||
//-- End | ||
} | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
demo/src/main/scala/demo/BarcodeScannerDialogExample.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package demo | ||
|
||
import be.doeraene.webcomponents.ui5.* | ||
import be.doeraene.webcomponents.ui5.configkeys.* | ||
import com.raquo.laminar.api.L.* | ||
import demo.helpers.{DemoPanel, Example, FetchDemoPanelFromGithub} | ||
|
||
object BarcodeScannerDialogExample extends Example("BarcodeScannerDialog") { | ||
|
||
def component(using demoPanelInfoMap: FetchDemoPanelFromGithub.CompleteDemoPanelInfo): HtmlElement = div( | ||
DemoPanel("Usage") { | ||
//-- Begin: Usage | ||
// Feed this bus in order to open the barcode scanner | ||
val openScannerBus: EventBus[Unit] = new EventBus | ||
|
||
// Feed this bus to pass the information of a failed scan | ||
val barcodeScanFailedBus: EventBus[BarcodeScannerDialog.events.ErrorInfo] = new EventBus | ||
// Feed this bus to pass the information of a successful scan | ||
val barcodeScanSuccessBus: EventBus[BarcodeScannerDialog.events.SuccessInfo] = new EventBus | ||
|
||
val barcodeScanEvents = EventStream | ||
.merge( | ||
barcodeScanSuccessBus.events, | ||
barcodeScanFailedBus.events | ||
) | ||
.mapTo(()) | ||
|
||
div( | ||
BarcodeScannerDialog( | ||
_.showOnEvents(openScannerBus.events), | ||
_.closeOnEvents(barcodeScanEvents), | ||
_.events.onScanSuccess.map(_.detail) --> barcodeScanSuccessBus.writer, | ||
_.events.onScanError.map(_.detail) --> barcodeScanFailedBus.writer | ||
), | ||
Title.h3(_ => "Click on the button below and show a QR code to the camera:"), | ||
Button( | ||
_.icon := IconName.camera, | ||
_.tooltip := "Start Camera", | ||
_ => "Scan", | ||
_.events.onClick.mapTo(()) --> openScannerBus.writer | ||
), | ||
div(Label(_ => child.text <-- barcodeScanSuccessBus.events.map(_.text))), | ||
div(Label(_ => child.text <-- barcodeScanFailedBus.events.map(_.message))) | ||
) | ||
//-- End | ||
} | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.