Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
3693aaf
feat: WC-219 isolate external styles for component
wesleyboar Jun 17, 2025
77c204e
fix: WC-219 change hook ext from jsx to js
wesleyboar Jun 18, 2025
c0050ad
fix: WC-219 fix hot reload error, add test
wesleyboar Jun 18, 2025
d4950a4
refactor: WC-219 organize code more cleanly
wesleyboar Jun 18, 2025
b1dfb85
refactor: WC-219 change solution from DOM to CSS
wesleyboar Jun 18, 2025
84c0c7b
chore: WC-219 remove cruft
wesleyboar Jun 18, 2025
30cff34
feat: WC-219 hide navbar, simplify cms content CSS
wesleyboar Jun 18, 2025
23cfe96
feat: WC-219 match test CMS content perfectly
wesleyboar Jun 19, 2025
2c9c90b
chore: WC-219 delete shadow dom attempt
wesleyboar Jun 19, 2025
83b0cbd
refactor: WC-219 rename files
wesleyboar Jun 19, 2025
097032b
fix: WC-219 missing part of "rename files" commit
wesleyboar Jun 20, 2025
0d8f527
chore: WC-219 delete outdated import
wesleyboar Jun 20, 2025
5acc262
fix: WC-219 attrname vs attrName in JSX
wesleyboar Jun 20, 2025
7743de9
fix: WC-219 file accidentally deleted
wesleyboar Jun 20, 2025
14e0846
refactor: WC-219 extract breadcrumbs
wesleyboar Jun 20, 2025
149a2ea
fix: header styles overwritten by mimic-cms styles
wesleyboar Jun 20, 2025
4d035ea
fix: basic text color too dark
wesleyboar Jun 20, 2025
54c6376
feat!: footer from CMS
wesleyboar Jun 20, 2025
bf6515b
refactor: cms-footer ID changed to just footer
wesleyboar Jun 20, 2025
24271c3
chore: remove unused class
wesleyboar Jun 20, 2025
5f5050a
feat: only load CMS footer when necessary
wesleyboar Jun 20, 2025
e3d0b2d
docs: "make CMS styles conditional like … footer"
wesleyboar Jun 23, 2025
8dff220
feat: "make CMS styles conditional like … footer"
wesleyboar Jun 23, 2025
8f109e2
docs: delete "make CMS styles conditional …"
wesleyboar Jun 23, 2025
f696000
fix: move DataFiles CSS back to DataFiles
wesleyboar Jun 23, 2025
74612f2
refactor: simplify cms_styles.html
wesleyboar Jun 23, 2025
67c9282
fix: cms_styles not disabled
wesleyboar Jun 24, 2025
21edb58
chore: restore new line
wesleyboar Jun 24, 2025
e74b1ca
chore: simplify DataFiles…Breadcrumbs
wesleyboar Jun 24, 2025
fd71637
refactor: CMSWrapper
wesleyboar Jun 24, 2025
fc391de
refactor: clean up so DPM usage is clearer
wesleyboar Jun 24, 2025
67ebe74
chore: use `latest` cms image again
wesleyboar Jun 24, 2025
607d07c
fix: does not match CMS UI exactly
wesleyboar Jun 25, 2025
8874dee
refactor cms_styles → cms_ui
wesleyboar Jun 25, 2025
4718cf0
Merge branch 'feat/WC-274-allow-dpm-to-load-external-styles-sans-conf…
wesleyboar Jun 25, 2025
334dab0
chore: npm prettier--write client
wesleyboar Jun 25, 2025
217d228
chore: npm run lint:css
wesleyboar Jun 25, 2025
054c3f9
fix: footer on CMS layout
wesleyboar Jun 26, 2025
fcc6120
chore: remove duplicate code
wesleyboar Jun 26, 2025
3e73aaa
chore: remove stray `async` keyword
wesleyboar Jun 26, 2025
8791975
fix: CMS footer present upon return to regular Portal
wesleyboar Jun 27, 2025
a84f12b
fix: DataFilesForDPM.global.css bleed
wesleyboar Jun 27, 2025
6017b41
feat: CMSWrapper useDynamicStylesheets
wesleyboar Jun 27, 2025
b9aac22
refactor: move <main> to CMSWrapper only
wesleyboar Jun 27, 2025
5679240
chore: npm prettier --write client
wesleyboar Jun 27, 2025
9b79905
docs: remove pagination comment
wesleyboar Jun 27, 2025
c6edca9
chore: comment format
wesleyboar Jun 27, 2025
3490cc8
test: other sample content
wesleyboar Jun 27, 2025
302ec3d
feat: navigate sample content
wesleyboar Jun 27, 2025
597e833
fix: remove tab-content/pane styles
wesleyboar Jun 27, 2025
845b2dc
fix: image url and attr whitepsace
wesleyboar Jun 27, 2025
06a9a1f
fix: whtiespace between HTML tags for DPMRead
wesleyboar Jun 27, 2025
c3963bd
Merge branch 'main' into feat/WC-274-allow-dpm-to-load-external-style…
wesleyboar Jun 27, 2025
dd7fb2c
chore: npm prettier --write client
wesleyboar Jun 27, 2025
aba0962
Merge branch 'feat/WC-274-allow-dpm-to-load-external-styles-sans-conf…
wesleyboar Jun 27, 2025
07bb332
fix: misaligned image in <div> missing `container`
wesleyboar Jun 30, 2025
b741029
fix: wrong markup for heading
wesleyboar Jun 30, 2025
14197a8
fix: nested container alignement
wesleyboar Jun 30, 2025
134827f
chore: npm prettier --write client
wesleyboar Jun 30, 2025
a3dda1d
fix: missing spaces
wesleyboar Jun 30, 2025
94c8ff4
fix: misaligned nested container
wesleyboar Jun 30, 2025
dc9398f
Merge branch 'task/digital-rocks' into feat/WC-274-allow-dpm-to-load-…
wesleyboar Jul 2, 2025
f96f5ec
fix: poetry lock
wesleyboar Jul 2, 2025
1f2c175
fix: do not import s-footer twice
wesleyboar Jul 2, 2025
a118c97
fix: mirror TACC/Core-CMS-Custom#494 updates
wesleyboar Jul 3, 2025
7b8d4f7
deps: Core-Styles v2.45
wesleyboar Jul 3, 2025
7066762
enhance: migrate styles from CDN to here
wesleyboar Jul 3, 2025
aef0da5
refactor: reorg styles so CMS can load 'em cleanly
wesleyboar Jul 3, 2025
1dc6f0a
chore: use latest corestyles, if used via CDN
wesleyboar Jul 3, 2025
fc8f419
chore: core-cms v4.33 via latest
wesleyboar Jul 4, 2025
90890d2
fix: manually revert unintentional change
wesleyboar Jul 4, 2025
eb1f9ab
Revert "fix: manually revert unintentional change"
wesleyboar Jul 4, 2025
f6be6fd
fix: condifently revert unintentional changes
wesleyboar Jul 4, 2025
5848141
fix: delete stray file
wesleyboar Jul 4, 2025
0efd64b
fix: inaccurate href value
wesleyboar Jul 7, 2025
e217fbc
fix: modals, dropdowns, tabs (new bootstrap, v5)
wesleyboar Jul 7, 2025
49e2642
fix: missing modals data- attr update
wesleyboar Jul 7, 2025
f5e32d2
chore: remove `data-tag-change-from` attributes
wesleyboar Jul 7, 2025
b49998b
fix: tooltips
wesleyboar Jul 7, 2025
25f31c1
fix: modal content styles
wesleyboar Jul 7, 2025
803bc8a
fix: limit portal modal content styles to portal
wesleyboar Jul 7, 2025
9761898
fix: dropdown styles
wesleyboar Jul 7, 2025
e0916df
refactor: delete sample components + their styles
wesleyboar Jul 7, 2025
84f747d
Merge branch 'task/digital-rocks' into feat/WC-274-allow-dpm-to-load-…
shayanaijaz Jul 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
"devDependencies": {
"@rollup/plugin-eslint": "^8.0.1",
"@tacc/core-styles": "^2.39.4",
"@tacc/core-styles": "^2.45.0",
"@testing-library/jest-dom": "^5.0.2",
"@testing-library/react": "^16.0.1",
"@types/js-cookie": "^3.0.6",
Expand Down
49 changes: 49 additions & 0 deletions client/src/components/_common/CMSBreadcrumbs/CMSBreadcrumbs.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';

export default function CMSBreadcrumbs() {
/* TODO: Move to …module.css OR into Core-Styles */
/* https://github.com/TACC/Core-CMS/blob/v4.30.0/taccsite_cms/templates/nav_cms_breadcrumbs.html#L4-L11 */
const breadcrumbCSS = `
.s-breadcrumbs a:not([href]) {
opacity: 1;
color: unset;
}
`;

/* TODO: Migrate to JSX logic (when it exists) */
React.useEffect(() => {
// Disable href for the current page breadcrumb
const crumbs = document.getElementById('cms-breadcrumbs');
const secondLink = crumbs && crumbs.querySelector('li:nth-of-type(2) > a');
if (secondLink) secondLink.removeAttribute('href');
}, []);

/* TODO: Render based on data param, not as static content */
return (
<>
<style dangerouslySetInnerHTML={{ __html: breadcrumbCSS }} />
<nav className="s-breadcrumbs" id="cms-breadcrumbs">
<ol itemScope itemType="https://schema.org/BreadcrumbList">
<li
itemScope
itemProp="itemListElement"
itemType="https://schema.org/ListItem"
>
<a href="/" itemProp="item">
<span itemProp="name">Index</span>
</a>
<meta itemProp="position" content="1" />
</li>
<li
itemScope
itemProp="itemListElement"
itemType="https://schema.org/ListItem"
>
<span itemProp="name">Browse Datasets</span>
<meta itemProp="position" content="2" />
</li>
</ol>
</nav>
</>
);
}
1 change: 1 addition & 0 deletions client/src/components/_common/CMSBreadcrumbs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './CMSBreadcrumbs';
25 changes: 25 additions & 0 deletions client/src/components/_common/CMSWrapper/CMSWrapper.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, { useEffect } from 'react';

import PropTypes from 'prop-types';

function CMSWrapper({ children }) {
useEffect(() => {
// To (de)activate CMS styles on (un)mount
window.dispatchEvent(new CustomEvent('cms-styles-activated'));
return () => {
window.dispatchEvent(new CustomEvent('cms-styles-deactivated'));
};
}, []);

return (
<main id="mimic-cms" className="container">
{children}
</main>
);
}

CMSWrapper.propTypes = {
children: PropTypes.node.isRequired,
};

export default CMSWrapper;
1 change: 1 addition & 0 deletions client/src/components/_common/CMSWrapper/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './CMSWrapper';
2 changes: 2 additions & 0 deletions client/src/components/_common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export {
default as IntroMessage,
isKnownMessage as isKnownIntroMessage,
} from './IntroMessage';
export { default as CMSBreadcrumbs } from './CMSBreadcrumbs';
export { default as CMSWrapper } from './CMSWrapper';
export { default as CustomMessage } from './CustomMessage';
export { default as Pill } from './Pill';
export { default as TextCopyField } from './TextCopyField';
Expand Down
18 changes: 11 additions & 7 deletions client/src/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@import url('./styles/global.css');
@import url('./styles/global.css') layer(portal);

@layer portal {

/*
Sectioning Root
Expand Down Expand Up @@ -51,8 +53,7 @@ code {
/* FAQ: The `html` and `body` boxes are only as tall as their content
(which may be shorter than window height), cannot have siblings elements
(would be influenced by force stretch), so force stretch outward. */
html,
body {
body:not(.has-cms-ui) {
/* As a stretched item */
position: absolute;
left: 0;
Expand All @@ -75,31 +76,34 @@ body {
/* FAQ: The `.content` and `#react-root` boxes are only as tall as their content
(which may be shorter than window height), can have siblings elements
(would be influenced by force stretch), so gently stretch outward. */
body {
body:not(.has-cms-ui) {
/* As a flex container */
display: flex;
flex-direction: column;
}
body > .content {
body:not(.has-cms-ui) .content {
/* As a flex item */
flex-grow: 1;

/* As a flex container */
display: flex;
flex-direction: column;
}
#react-root {
body:not(.has-cms-ui) #react-root {
/* As a flex item */
flex-grow: 1;

/* As a stretched item container */
position: relative;
}
#react-root > :only-child {
body:not(.has-cms-ui) #react-root > :only-child {
/* As a stretched item */
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}

/* end @layer portal */
}
7 changes: 7 additions & 0 deletions client/src/styles/components/bootstrap.tooltip.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
i[data-bs-toggle="tooltip"] {
font-style: normal;
}

.tooltip-inner {
font-size: var(--global-font-size--medium);
}
4 changes: 3 additions & 1 deletion client/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/* SETTINGS */
@import url('@tacc/core-styles/src/lib/_imports/settings/border.css');
@import url('./settings/color.css');
@import url('./settings/font.css');
@import url('@tacc/core-styles/dist/settings/font.css');
@import url('@tacc/core-styles/dist/settings/font--portal.css');
@import url('./settings/space.css');

/* TOOLS */
Expand All @@ -29,6 +30,7 @@
@import url('./components/bootstrap.nav.css');
@import url('./components/bootstrap.utils.css');
@import url('./components/bootstrap.button.css');
@import url('./components/bootstrap.tooltip.css');
@import url('./components/mui.tabs.css');

/* TRUMPS */
Expand Down
12 changes: 0 additions & 12 deletions client/src/styles/settings/font.css

This file was deleted.

12 changes: 7 additions & 5 deletions server/portal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
<link rel="canonical" href="{{request.get_full_path}}">
<base href="/">
{% block head_extra %}{% endblock %}
<style>
@layer portal, mimic-cms, header;
@import url("https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css") layer(portal);
@import url("/static/site_cms/css/build/core-styles.theme.default.css") layer(header);
@import url("/static/site_cms/css/build/core-styles.header.css") layer(header);
</style>
{% if settings.PORTAL_CSS_FILENAMES|length %}
<!-- Project CSS -->
{% for stylesheet in settings.PORTAL_CSS_FILENAMES %}
<link rel="stylesheet" href="{{ stylesheet }}">
{% endfor %}
{% endif %}
<!-- Vendor CSS -->
<link id="css-bootstrap" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- Header CSS -->
<link rel="stylesheet" href="/static/site_cms/css/build/core-styles.theme.default.css">
<link rel="stylesheet" href="/static/site_cms/css/build/core-styles.header.css">

{% block styles %}{% endblock %}
</head>
Expand All @@ -38,6 +39,7 @@
{% block content %}{% endblock %}
</div>
{% include 'includes/footer.html' %}
{% include 'includes/cms_ui.html' %}
{% block scripts %}{% endblock %}
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
Expand Down
83 changes: 83 additions & 0 deletions server/portal/templates/includes/cms_ui.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<style id="cms-ui-styles" media="not all">{# i.e. disabled #}
@layer mimic-cms, mimic-cms.base, mimic-cms.project;

@import url(/static/site_cms/css/build/core-styles.base.css) layer(mimic-cms.base);
@import url(/static/site_cms/css/build/core-styles.cms.css) layer(mimic-cms.base);
@import url(/static/site_cms/css/build/core-cms.css) layer(mimic-cms.project);

/* To mimic a CMS idiosyncrasy */
/* https://github.com/TACC/Core-CMS/blob/v4.31.0/taccsite_cms/templates/base.html#L73-L76 */
#cms-content-container.container .container { padding-inline: 0; }

/* To mimic Bootstrap v4 (which CMS uses) */
.workbench-content .container { --bs-gutter-x: 15px; }
.workbench-content .row { --bs-gutter-x: 30px; }

/* To change high-level styles to match CMS */
.workbench-wrapper { color: var(--global-color-primary--x-dark); }
.workbench-content .container {
margin-left: revert-layer;
max-width: revert-layer;
}
.workbench-content .row {
margin-right: revert-layer;
margin-left: revert-layer;
}
body { -webkit-font-smoothing: revert; }
.c-button { --max-width: auto; }

/* To change Portal's Bootstrap styles to match CMS */
.workbench-wrapper .dropdown-menu,
.workbench-wrapper .dropdown-menu::before,
.workbench-wrapper .dropdown-menu::after,
.workbench-wrapper .dropdown-item,
.workbench-wrapper .dropdown-item:focus,
.workbench-wrapper .dropdown-item:hover,
.workbench-wrapper .dropdown-divider {
all: revert-layer;
}

/* To hide navbar */
/* TODO: Instead of this, component using CMS styles should not use navbar */
#react-root:has(#mimic-cms) .nav-sidebar {
display: none;
}
</style>

<script id="cms-ui-script" type="module">
let footerEl = null;
let footerOriginalMarkup = null;

const toggleStyles = (enabled) => {
const media = (enabled) ? 'all' : 'not all';
document.getElementById('cms-ui-styles').media = media;
};

const toggleLayout = (enabled) => {
document.body.classList.toggle('has-cms-ui', enabled);
};

const useCMSFooter = async () => {
footerEl = document.getElementById('footer');
footerOriginalMarkup = footerEl.outerHTML;

const { replaceFromURL } = await import('/static/site_cms/js/modules/importHTML.js');
footerEl = await replaceFromURL('/cms/markup/footer', footerEl);
};
const restorePortalFooter = () => {
footerEl.outerHTML = footerOriginalMarkup;
};

window.addEventListener('cms-styles-activated', async (event) => {
console.log(`event: ${event.type}`);
toggleStyles(true);
toggleLayout(true);
await useCMSFooter();
});
window.addEventListener('cms-styles-deactivated', (event) => {
console.log(`event: ${event.type}`);
toggleStyles(false);
toggleLayout(false);
restorePortalFooter();
});
</script>
2 changes: 1 addition & 1 deletion server/portal/templates/includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% load static %}
<footer class="container-fluid">
<footer id="footer">
</footer>
Loading