I threw this together to show the principle:
https://anvil.works/build#clone:24VCGPJYOSAP4DR6=C77EWVK6PJ2MC5R5LRUVDLHM