Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: align style use between docs and demo #1862

Merged
merged 10 commits into from
Sep 16, 2024
2 changes: 1 addition & 1 deletion .pfe.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"description": "Red Hat Design System",
"componentSubpath": "elements",
"stylesheets": [
"/docs/styles/dev-server/styles.css"
"/docs/styles/demo/dev-server.css"
zeroedin marked this conversation as resolved.
Show resolved Hide resolved
]
}
}
1 change: 0 additions & 1 deletion docs/_includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<head>
{% include "../partials/meta.html" %}

<link rel="stylesheet" href="/assets/packages/@rhds/tokens/css/global.css">
<link rel="stylesheet" href="/styles/styles.css">

{# On browsers that don't yet support native declarative shadow DOM, a
Expand Down
4 changes: 2 additions & 2 deletions docs/_includes/layouts/demo.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

<link rel="preconnect" href="https://ga.jspm.io">

<link rel="stylesheet" href="/styles/dev-server/styles.css" media="all">

<link rel="stylesheet" href="/styles/demo/styles.css" media="all">
<script type="importmap">{{ importMap | dump(2) | safe }}</script>
<script type="module">
// dsd polyfill needs to happen before hydration attempts
Expand Down
56 changes: 56 additions & 0 deletions docs/styles/demo/dev-server.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@layer
reset,
fonts,
tokens,
typography,
base,
layout,
third-party;

@import url('../reset.css') layer(reset);
@import url('../fonts.css') layer(fonts);
@import url('/node_modules/@rhds/tokens/css/global.css') layer(tokens);
@import url('../typography.css') layer(typography);
@import url('../third-party/prism-rhds.css') layer(third-party);

@layer base {
/**
* PFE based styles as we do not have control over the
* html layout that is upstream with no current override
*/
#main-header {
--pf-theme--color--surface--accent: black;
--pf-theme--color--accent: black;
}
}

@layer layout {
html,
body,
main { height: 100%; }

[data-demo] {
display: contents;
}

main {
display: block;
position: relative;
max-height: initial;
}

#nav {
height: 100%;
}

#main-header a img {
margin-right: 0;
}

/* offset the padding on the demo container from above */
rh-context-demo {
min-height: calc(100% + 2 * var(--rh-space-xl, 24px));
height: auto;
}
}

11 changes: 11 additions & 0 deletions docs/styles/demo/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@layer
reset,
fonts,
tokens,
typography;

@import url('../reset.css') layer(reset);
@import url('../fonts.css') layer(fonts);
@import url('/assets/packages/@rhds/tokens/css/global.css') layer(tokens);
@import url('../typography.css') layer(typography);

53 changes: 0 additions & 53 deletions docs/styles/dev-server/styles.css

This file was deleted.

2 changes: 2 additions & 0 deletions docs/styles/styles.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@layer
reset,
fonts,
tokens,
typography,
base,
grid,
Expand All @@ -16,6 +17,7 @@
@import url('not-defined.css') layer(not-defined);
@import url('reset.css') layer(reset);
@import url('fonts.css') layer(fonts);
@import url('/assets/packages/@rhds/tokens/css/global.css') layer(tokens);
@import url('typography.css') layer(typography);
@import url('grid.css') layer(grid);
@import url('lightdom.css') layer(lightdom);
Expand Down
7 changes: 1 addition & 6 deletions scripts/playgrounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,7 @@ class PlaygroundDemo {
}

private addCommonCss() {
const cssPrefix = this.demo.filePath.match(DEMO_FILEPATH_IS_MAIN_DEMO_RE) ? '' : '../';
this.append(this.createStyleLink(`${cssPrefix}reset.css`),
Tools.createTextNode('\n'),
this.createStyleLink(`${cssPrefix}fonts.css`),
Tools.createTextNode('\n'),
this.createStyleLink(`${cssPrefix}typography.css`));
this.append(this.createStyleLink(`/styles/demo/styles.css`));
}

private getFinalContent() {
Expand Down
2 changes: 1 addition & 1 deletion web-dev-server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const litcssOptions = {
/@rhds\/tokens\/css\/.*\.css$/,
/lib\/.*\.css$/,
]))),
exclude: /lightdom/,
exclude: [/lightdom/, /node_modules\/@rhds\/tokens\/css\/global\.css/],
};

export default pfeDevServerConfig({
Expand Down
Loading