datajunction-ui 0.0.1-a56 → 0.0.1-a57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datajunction-ui",
3
- "version": "0.0.1a56",
3
+ "version": "0.0.1a57",
4
4
  "description": "DataJunction Metrics Platform UI",
5
5
  "module": "src/index.tsx",
6
6
  "repository": {
@@ -39,7 +39,7 @@ describe('<Root />', () => {
39
39
  'href',
40
40
  '/sql',
41
41
  );
42
- expect(screen.getByText('Docs').closest('a')).toHaveAttribute(
42
+ expect(screen.getByText('Open-Source').closest('a')).toHaveAttribute(
43
43
  'href',
44
44
  'https://www.datajunction.io',
45
45
  );
@@ -5,6 +5,21 @@ import { Helmet } from 'react-helmet-async';
5
5
  import DJClientContext from '../../providers/djclient';
6
6
  import Search from '../../components/Search';
7
7
 
8
+ // Define the type for the docs sites
9
+ type DocsSites = {
10
+ [key: string]: string;
11
+ };
12
+
13
+ // Default docs sites if REACT_APP_DOCS_SITES is not defined
14
+ const defaultDocsSites: DocsSites = {
15
+ "Open-Source": "https://www.datajunction.io/"
16
+ };
17
+
18
+ // Parse the JSON map from the environment variable or use the default
19
+ const docsSites: DocsSites = process.env.REACT_APP_DOCS_SITES
20
+ ? JSON.parse(process.env.REACT_APP_DOCS_SITES as string) as DocsSites
21
+ : defaultDocsSites;
22
+
8
23
  export function Root() {
9
24
  const djClient = useContext(DJClientContext).DataJunctionAPI;
10
25
 
@@ -12,14 +27,12 @@ export function Root() {
12
27
  await djClient.logout();
13
28
  window.location.reload();
14
29
  };
30
+
15
31
  return (
16
32
  <>
17
33
  <Helmet>
18
34
  <title>DataJunction</title>
19
- <meta
20
- name="description"
21
- content="DataJunction Metrics Platform Webapp"
22
- />
35
+ <meta name="description" content="DataJunction Metrics Platform Webapp" />
23
36
  </Helmet>
24
37
  <div className="container d-flex align-items-center justify-content-between">
25
38
  <div className="header">
@@ -53,13 +66,26 @@ export function Root() {
53
66
  </span>
54
67
  <span className="menu-link">
55
68
  <span className="menu-title">
56
- <a
57
- href="https://www.datajunction.io"
58
- target="_blank"
59
- rel="noreferrer"
60
- >
61
- Docs
62
- </a>
69
+ <div className="dropdown">
70
+ <a
71
+ className="btn btn-link dropdown-toggle"
72
+ href="#"
73
+ id="docsDropdown"
74
+ role="button"
75
+ aria-expanded="false"
76
+ >
77
+ Docs
78
+ </a>
79
+ <ul className="dropdown-menu" aria-labelledby="docsDropdown">
80
+ {Object.entries(docsSites).map(([key, value]) => (
81
+ <li key={key}>
82
+ <a className="dropdown-item" href={value} target="_blank" rel="noreferrer">
83
+ {key}
84
+ </a>
85
+ </li>
86
+ ))}
87
+ </ul>
88
+ </div>
63
89
  </span>
64
90
  </span>
65
91
  </div>
@@ -80,4 +106,4 @@ export function Root() {
80
106
  <Outlet />
81
107
  </>
82
108
  );
83
- }
109
+ }
@@ -1476,4 +1476,30 @@ table {
1476
1476
  }
1477
1477
  .active {
1478
1478
  border-bottom: 2px solid #007acc;
1479
+ }
1480
+ .dropdown-menu {
1481
+ display: none;
1482
+ position: absolute;
1483
+ top: 100%;
1484
+ left: 0;
1485
+ z-index: 1000;
1486
+ float: left;
1487
+ min-width: 15rem;
1488
+ padding: 0.5rem;
1489
+ margin: 0;
1490
+ font-size: 1rem;
1491
+ color: #212529;
1492
+ text-align: left;
1493
+ list-style: none;
1494
+ background-color: #fff;
1495
+ background-clip: padding-box;
1496
+ border: 1px solid rgba(0, 0, 0, 0.15);
1497
+ border-radius: 0.25rem;
1498
+ box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
1499
+ }
1500
+ .dropdown {
1501
+ position: relative;
1502
+ }
1503
+ .dropdown:hover .dropdown-menu {
1504
+ display: block;
1479
1505
  }