Skip to content

Commit

Permalink
HelpHoverable template implementation, updates
Browse files Browse the repository at this point in the history
Signed-off-by: Fenn-CS <[email protected]>
  • Loading branch information
nfebe committed Jan 11, 2021
1 parent e6e840b commit af76136
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
1 change: 1 addition & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default {
__VERSION__: execSync("git rev-list HEAD --max-count=1")
.toString()
.trim(),
// workaround the way sveltejs-tippy imports tippy: https://github.com/mdauner/sveltejs-tippy/issues/117
"process.env.NODE_ENV": JSON.stringify(
production ? "production" : "development"
),
Expand Down
8 changes: 5 additions & 3 deletions src/components/HelpHoverable.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script>
import tippy from "sveltejs-tippy";
import InfoIcon from "./icons/InfoIcon.svelte";
export let content;
export let link;
export let props = {
content: "<span class='tooltip'>Tooltip Info</span>",
content,
allowHTML: true,
placement: "top",
};
export let link;
</script>

<style>
Expand All @@ -18,6 +20,6 @@

<div class="main">
<a href={link} use:tippy={props}>
<slot />
<InfoIcon />
</a>
</div>
3 changes: 1 addition & 2 deletions src/data/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default {
send_in_pings: {
text:
"Defines which pings the metric should be sent on. If not specified, the metric is sent on the 'default ping', which is the events ping for events and the metrics ping for everything else. Most metrics don't need to specify this unless they are sent on custom pings.",
// link:
// "https://mozilla.github.io/glean/book/user/metric-parameters.html",
link: "https://mozilla.github.io/glean/book/user/metric-parameters.html",
},
};
21 changes: 6 additions & 15 deletions src/pages/MetricDetail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import { getMetricBigQueryURL } from "../state/urls";
import Markdown from "../components/Markdown.svelte";
import NotFound from "../components/NotFound.svelte";
import InfoIcon from "../components/icons/InfoIcon.svelte";
import HelpHoverable from "../components/HelpHoverable.svelte";
import help from "../data/help";
import helpText from "../data/help";
export let params;
let metricName = params.metric.replaceAll("-", ".");
Expand Down Expand Up @@ -80,11 +79,7 @@
<tr>
<td>
Relevant Bugs
<HelpHoverable
props={{ content: help.bugs.text, allowHTML: true }}
link={help.bugs.link}>
<InfoIcon />
</HelpHoverable>
<HelpHoverable content={helpText.bugs.text} link={helpText.bugs.link} />
</td>
<td>
{#each metric.bugs as bug}
Expand All @@ -101,10 +96,8 @@
<td>
Send In Pings
<HelpHoverable
props={{ content: help.send_in_pings.text, allowHTML: true }}
link={help.send_in_pings.link}>
<InfoIcon />
</HelpHoverable>
content={helpText.send_in_pings.text}
link={helpText.send_in_pings.link} />
</td>
<td>
{#each metric.send_in_pings as name}
Expand All @@ -121,10 +114,8 @@
Lifetime
</a>
<HelpHoverable
props={{ content: help.lifetime.text }}
link={help.lifetime.link}>
<InfoIcon />
</HelpHoverable>
content={helpText.lifetime.text}
link={helpText.lifetime.link} />
</td>
<td>{metric.lifetime}</td>
</tr>
Expand Down

0 comments on commit af76136

Please sign in to comment.