From 64c6fb119164afcfc654ccee3c2ad96426f17a0c Mon Sep 17 00:00:00 2001 From: sanine-a Date: Tue, 13 Apr 2021 13:03:55 -0500 Subject: add StyleDropdown.js --- StyleDropdown.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 StyleDropdown.js (limited to 'StyleDropdown.js') diff --git a/StyleDropdown.js b/StyleDropdown.js new file mode 100644 index 0000000..f2f0f65 --- /dev/null +++ b/StyleDropdown.js @@ -0,0 +1,25 @@ +function StyleDropdown({ options, index, onChoose, defaultText }) +{ + const text = index < 0 ? defaultText : options[index]; + + let optionLinks = []; + for (let i=0; i onChoose(i) + }, + options[i] + ) + ); + + return h( + 'div.StyleDropdownContainer', {} + [ + h('button.StyleDropdownButton', {}, text), + + h('div.StyleDropdownContent', {}, optionLinks) + ] + ); +} -- cgit v1.2.1