Streamsync Gallery Component #144
-
Is there any way to make an gallery (without using the HTML component)? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Currently, there isn't any dedicated component to do a gallery. You can make something using the repeater and the image component. import streamsync as ss
# This is a placeholder to get you started or refresh your memory.
# Delete it or adapt it as necessary.
# Documentation is available at https://streamsync.cloud
def click_img(state, context):
state["image"] = context['item']
# Initialise the state
# "_my_private_element" won't be serialised or sent to the frontend,
# because it starts with an underscore
initial_state = ss.init_state({
"my_app": {
"title": "My App"
},
"images": {
"1": {
"caption": "curiosity",
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/PIA16239_High-Resolution_Self-Portrait_by_Curiosity_Rover_Arm_Camera_square.jpg/600px-PIA16239_High-Resolution_Self-Portrait_by_Curiosity_Rover_Arm_Camera_square.jpg"
},
"2": {
"caption": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/MarsCuriosityRover-Drilling-Sol170%2B%2B-2.jpg/542px-MarsCuriosityRover-Drilling-Sol170%2B%2B-2.jpg",
},
"3": {
"caption": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c0/Mars_2020_selfie_containing_both_perseverance_rover_and_ingenuity.gif/800px-Mars_2020_selfie_containing_both_perseverance_rover_and_ingenuity.gif",
},
"4": {
"caption": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/PIA16226-MarsCuriosityRover-FirstScoopOfSoil-20121007.jpg/1920px-PIA16226-MarsCuriosityRover-FirstScoopOfSoil-20121007.jpg",
}
},
"image": {
"caption": "curiosity",
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/PIA16239_High-Resolution_Self-Portrait_by_Curiosity_Rover_Arm_Camera_square.jpg/600px-PIA16239_High-Resolution_Self-Portrait_by_Curiosity_Rover_Arm_Camera_square.jpg"
}
}) |
Beta Was this translation helpful? Give feedback.
-
I have written an application sample you can run |
Beta Was this translation helpful? Give feedback.
-
Hello @FabienArcellier |
Beta Was this translation helpful? Give feedback.
Currently, there isn't any dedicated component to do a gallery. You can make something using the repeater and the image component.
component tree