From 39e62fbdc173f13d9ff0d01d4732e3d3769bf43a Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Fri, 13 Sep 2024 10:36:55 -0500 Subject: [PATCH] CLDR-17934 user-visible sitemap - add a popup site map --- docs/site/assets/css/page.css | 37 +++++++++- docs/site/assets/js/cldrsite.js | 126 ++++++++++++++++++++++++++++---- 2 files changed, 143 insertions(+), 20 deletions(-) diff --git a/docs/site/assets/css/page.css b/docs/site/assets/css/page.css index 6f5b50aa896..3c82fae7d63 100644 --- a/docs/site/assets/css/page.css +++ b/docs/site/assets/css/page.css @@ -40,21 +40,50 @@ header .nav a.uplink { color: white; } -header .nav div.subpages { +div.showmap { + position: absolute; + right: 1em; + color: white; +} + +div.showmap:hover { + text-decoration: underline; + color: white; +} + +header .nav div.subpages, +div.sitemap { box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); z-index: 1; background-color: white; - position: absolute; + position: fixed; color: black; padding: 0.5em; } -div.subpages .hamburger { - left: 1em; +div.submap { + margin-left: 1em; + border-left: 1px solid gray; + padding-left: 0.5em; +} + +div.subpages > .hamburger, +div.sitemap .hamburger { + position: absolute; + right: 1em; top: 1em; color: darkslateblue; } +div.sitemap { + height: 90%; +} + +div.sitemap > div.submap { + height: 95%; + overflow-y: scroll; +} + .subpages .hamburger:hover { color: gray; } diff --git a/docs/site/assets/js/cldrsite.js b/docs/site/assets/js/cldrsite.js index 57342cf5768..7fdcf4410a3 100644 --- a/docs/site/assets/js/cldrsite.js +++ b/docs/site/assets/js/cldrsite.js @@ -51,8 +51,107 @@ async function siteData() { return j; } +const AncestorPages = { + props: ["ancestorPages"], + setup() {}, + template: ` + + {{ ancestor.title }} + +`, +}; + +const SubPagesPopup = { + props: { + children: { + type: Object, + required: true, + }, + }, + emits: ["hide"], // when user clicks hide + setup() {}, + methods: { + hide() { + this.$emit("hide"); + }, + }, + template: ` +
+ + +
+`, +}; + +const SubMap = { + name: "SubMap", + props: { + usermap: { + type: Object, + required: true, + }, + path: String, + }, + setup() {}, + computed: { + title() { + return this.usermap[this.path].title; + }, + children() { + return this.usermap[this.path].children || []; + }, + href() { + return path2url(this.path); + }, + }, + template: ` +
+ {{title}} + +
+ `, +}; + +const SiteMap = { + props: { + tree: { + type: Object, + required: true, + }, + }, + components: { + SubMap, + }, + emits: ["hide"], + setup() {}, + methods: { + hide() { + this.$emit("hide"); + }, + }, + template: ` +
+ + Site Map
+ +
+ `, +}; + const app = Vue.createApp( { + components: { + AncestorPages, + SubPagesPopup, + SiteMap, + }, setup(props) { // the tree.json data const tree = ref({}); @@ -60,11 +159,14 @@ const app = Vue.createApp( const status = ref(null); // is the popup menu shown? const popup = ref(false); + // is the site map shown? + const showmap = ref(false); return { tree, status, popup, + showmap, }; }, mounted() { @@ -157,27 +259,19 @@ const app = Vue.createApp( src="/assets/img/logo60s2.gif" alt="[Unicode]" width="34" height="33">   - - {{ ancestor.title }} - + +
{{ ourTitle }}
-
- {{ ourTitle }} - +
+ + {{ ourTitle }} +
+
Site Map
+
`, },