Skip to content

Commit bc000ac

Browse files
authored
adding new lux header (#1013)
* adding new lux header * updating packages * adding lux header dropdown component * linting and dependencies * refining header and importing appropriate utils * updating yarn install * fixing mediaflux version bug * settings * eslint * more linting * adding vite import and resolves to get lux working * drafting lux header * finalizing new TD header * tests
1 parent 8a93b6b commit bc000ac

File tree

12 files changed

+7549
-441
lines changed

12 files changed

+7549
-441
lines changed

app/assets/stylesheets/_settings.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
.container{ //Main body of every page
23
background-color: rgb(255, 255, 255);
34
padding-top: 2em;

app/assets/stylesheets/application.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
* files in this directory. Styles in this file should be added after the last require_* statement.
1111
* It is generally better to create a new file per style scope.
1212
*/
13-
13+
/* Import the LUX styles */
14+
@import "lux-design-system/dist/style.css";
1415
@import "bootstrap";
1516
@import "variables";
1617

@@ -36,4 +37,3 @@ body {
3637
}
3738
}
3839

39-

app/javascript/entrypoints/application.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,30 @@ import 'bootstrap/js/src/scrollspy';
1212

1313
import * as bootstrap from 'bootstrap';
1414

15+
// ActionCable Channels
16+
import '../channels';
17+
18+
import { createApp } from 'vue';
19+
import lux from 'lux-design-system';
1520
import { setTargetHtml } from './helper';
1621
import UserDatalist from './user_datalist';
1722
import { displayMediafluxVersion } from './mediafluxVersion';
1823
import { showCreateScript } from './atermScripts';
1924

20-
// ActionCable Channels
21-
import '../channels';
25+
import 'lux-design-system/dist/style.css';
26+
import '../../assets/stylesheets/application.scss';
27+
28+
const app = createApp({});
29+
const createMyApp = () => createApp(app);
30+
31+
document.addEventListener('DOMContentLoaded', () => {
32+
const elements = document.getElementsByClassName('lux');
33+
for (let i = 0; i < elements.length; i += 1) {
34+
createMyApp()
35+
.use(lux)
36+
.mount(elements[i]);
37+
}
38+
});
2239

2340
window.bootstrap = bootstrap;
2441
window.displayMediafluxVersion = displayMediafluxVersion;

app/views/layouts/application.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
1111

12-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
12+
1313
<%= action_cable_meta_tag %>
1414
<%= vite_client_tag %>
15-
<script src="//code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
1615
<%= vite_javascript_tag 'application' %>
16+
<script src="//code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
1717

1818
<!--
1919
If using a TypeScript entrypoint file:

app/views/shared/_header.html.erb

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
<header>
2-
<div id="header">
3-
<nav>
4-
<a href="/"><%= image_tag("TigerData-LOGO-KO_wide2.svg", alt: "TigerData logo", size: "150x100", id: "logo") %></a>
5-
<div class="body">
6-
<%= link_to "Home", root_path, class: "navbar-brand"%>
1+
<nav>
2+
<div class="lux">
73
<% if current_user %>
8-
User: <%= current_user.uid%>
9-
<%= link_to "Log Out", main_app.destroy_user_session_path, class: "btn btn-warning btn-sm" %>
4+
<lux-library-header abbr-name="TD" theme="dark">
5+
<template v-slot:logo> <a href="/"><%= image_tag("TigerData-LOGO-KO_wide2.svg", alt: "TigerData logo", size: "150x100", id: "logo") %></a> </template>
6+
<lux-menu-bar type="main-menu" :menu-items="[
7+
{name: 'Contact US', component: 'Home', href: 'mailto:[email protected]'},
8+
{name: 'FAQ', component: 'Home', href: 'https://tigerdata.princeton.edu/frequently-asked-questions'},
9+
{name: '<%= current_user.display_name %>', component: 'Account', href: '/account/', children: [
10+
{name: 'Account Settings', component: 'Account', href: '/'},
11+
{name: 'Logout', component: 'Logout', href: '<%= main_app.destroy_user_session_path %> '}
12+
]}
13+
]"
14+
></lux-menu-bar>
15+
</lux-library-header>
1016
<% else %>
11-
<%= button_to "Log In", user_cas_omniauth_authorize_path, class: "btn btn-warning btn-sm" %>
17+
<lux-library-header abbr-name="TD" theme="dark">
18+
<template v-slot:logo><a href="/"><%= image_tag("TigerData-LOGO-KO_wide2.svg", alt: "TigerData logo", size: "150x100", id: "logo") %></a> </template>
19+
<%= button_to "Log In", user_cas_omniauth_authorize_path, class: "btn btn-warning btn-sm" %>
20+
</lux-library-header>
1221
<% end %>
13-
</div>
14-
</nav>
15-
</div>
16-
</header>
22+
</div>
23+
</nav>

0 commit comments

Comments
 (0)