From 203604a463f900cfef0980a629ddfe9fb14c39ad Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Mon, 24 Aug 2020 11:47:44 +0200 Subject: [PATCH] Copy patternfly import files from cockpit project automatically Closes #357 --- .gitignore | 1 + .travis.yml | 3 +- Makefile | 11 ++++++-- src/index.js | 4 +-- src/lib/_fonts.scss | 36 ------------------------ src/lib/patternfly-4-cockpit.scss | 14 ---------- src/lib/patternfly-4-overrides.scss | 43 ----------------------------- 7 files changed, 13 insertions(+), 99 deletions(-) delete mode 100644 src/lib/_fonts.scss delete mode 100644 src/lib/patternfly-4-cockpit.scss delete mode 100644 src/lib/patternfly-4-overrides.scss diff --git a/.gitignore b/.gitignore index 32b6401..b28fd69 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,6 @@ Test*FAIL* bots/ test/common/ test/images/ +src/lib/patternfly/ *.pot POTFILES* diff --git a/.travis.yml b/.travis.yml index 2b45223..403be86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,5 +4,4 @@ language: node_js node_js: - "8" script: - - npm install - - npm run build + - make diff --git a/Makefile b/Makefile index 1325afa..ead3972 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ dist/po.%.js: po/%.po $(NODE_MODULES_TEST) %.spec: %.spec.in sed -e 's/%{VERSION}/$(VERSION)/g' $< > $@ -$(WEBPACK_TEST): $(NODE_MODULES_TEST) $(shell find src/ -type f) package.json webpack.config.js $(patsubst %,dist/po.%.js,$(LINGUAS)) +$(WEBPACK_TEST): $(NODE_MODULES_TEST) src/lib/patternfly/_fonts.scss $(shell find src/ -type f) package.json webpack.config.js $(patsubst %,dist/po.%.js,$(LINGUAS)) NODE_ENV=$(NODE_ENV) npm run build watch: @@ -100,7 +100,7 @@ $(TARFILE): $(WEBPACK_TEST) cockpit-$(PACKAGE_NAME).spec touch dist/* tar czf cockpit-$(PACKAGE_NAME)-$(VERSION).tar.gz --transform 's,^,cockpit-$(PACKAGE_NAME)/,' \ --exclude cockpit-$(PACKAGE_NAME).spec.in \ - $$(git ls-files) package-lock.json cockpit-$(PACKAGE_NAME).spec dist/ + $$(git ls-files) src/lib/patternfly/*.scss package-lock.json cockpit-$(PACKAGE_NAME).spec dist/ mv node_modules.release node_modules srpm: $(TARFILE) cockpit-$(PACKAGE_NAME).spec @@ -157,6 +157,13 @@ test/common: git checkout --force FETCH_HEAD -- test/common git reset test/common +src/lib/patternfly/_fonts.scss: + git fetch --depth=1 https://github.com/cockpit-project/cockpit.git 227 + mkdir -p pkg/lib/patternfly && git add pkg/lib/patternfly + git checkout --force FETCH_HEAD -- pkg/lib/patternfly + git restore --staged pkg/lib/patternfly + mkdir -p src/lib && mv pkg/lib/patternfly src/lib/patternfly && rmdir -p pkg/lib + $(NODE_MODULES_TEST): package.json # if it exists already, npm install won't update it; force that so that we always get up-to-date packages rm -f package-lock.json diff --git a/src/index.js b/src/index.js index 85fa0c4..b718ab6 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,7 @@ * along with Cockpit; If not, see . */ -import "./lib/patternfly-4-cockpit.scss"; +import "./lib/patternfly/patternfly-4-cockpit.scss"; import "core-js/stable"; @@ -31,7 +31,7 @@ import { Application } from './app.jsx'; * out of the dist/index.js and since it will maintain the order of the imported CSS, * the overrides will be correctly in the end of our stylesheet. */ -import "./lib/patternfly-4-overrides.scss"; +import "./lib/patternfly/patternfly-4-overrides.scss"; document.addEventListener("DOMContentLoaded", function () { ReactDOM.render(React.createElement(Application, {}), document.getElementById('app')); diff --git a/src/lib/_fonts.scss b/src/lib/_fonts.scss deleted file mode 100644 index b3cb18a..0000000 --- a/src/lib/_fonts.scss +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Keep in sync with https://github.com/cockpit-project/cockpit/tree/master/src/base1/_fonts.scss - */ - -@mixin printRedHatFont( -$weightValue: 400, -$weightName: "Regular", -$familyName: "RedHatText", -$style: "normal", -$relative: true -) { - $filePath: "../../static/fonts" + "/" + $familyName + "-" + $weightName; - @font-face { - font-family: $familyName; - src: url('#{$filePath}.woff2') format('woff2'); - font-style: #{$style}; - font-weight: $weightValue; - text-rendering: optimizeLegibility; - } -} - -@include printRedHatFont(700, "Bold", $familyName: "RedHatDisplay"); -@include printRedHatFont(700, "BoldItalic", $style: "italic", $familyName: "RedHatDisplay"); -@include printRedHatFont(300, "Black", $familyName: "RedHatDisplay"); -@include printRedHatFont(300, "BlackItalic", $style: "italic", $familyName: "RedHatDisplay"); -@include printRedHatFont(300, "Italic", $style: "italic", $familyName: "RedHatDisplay"); -@include printRedHatFont(400, "Medium", $familyName: "RedHatDisplay"); -@include printRedHatFont(400, "MediumItalic", $style: "italic", $familyName: "RedHatDisplay"); -@include printRedHatFont(300, "Regular", $familyName: "RedHatDisplay"); - -@include printRedHatFont(300, "Bold"); -@include printRedHatFont(300, "BoldItalic", $style: "italic"); -@include printRedHatFont(300, "Italic"); -@include printRedHatFont(700, "Medium"); -@include printRedHatFont(700, "MediumItalic", $style: "italic"); -@include printRedHatFont(400, "Regular"); diff --git a/src/lib/patternfly-4-cockpit.scss b/src/lib/patternfly-4-cockpit.scss deleted file mode 100644 index 40da84e..0000000 --- a/src/lib/patternfly-4-cockpit.scss +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Keep in sync with https://github.com/cockpit-project/cockpit/tree/master/src/base1/patternfly-4-cockpit.scss - */ - -/* Set fake font and icon path variables - we are going to indentify these through - * string replacement and remove the relevant font-face declarations - */ -$pf-global--font-path: 'patternfly-fonts-fake-path'; -$pf-global--fonticon-path: 'patternfly-icons-fake-path'; -$pf-global--disable-fontawesome: true !default; // Disable Font Awesome 5 Free -@import '@patternfly/patternfly/patternfly-base.scss'; - -/* Import our own fonts since the PF4 font-face rules are filtered out with patternfly.sed */ -@import "./fonts"; diff --git a/src/lib/patternfly-4-overrides.scss b/src/lib/patternfly-4-overrides.scss deleted file mode 100644 index a02cb95..0000000 --- a/src/lib/patternfly-4-overrides.scss +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Keep in sync with https://github.com/cockpit-project/cockpit/tree/master/pkg/lib/patternfly-4-overrides.scss - */ - -/*** PF4 overrides ***/ - -/* WORKAROUND: Override word-break bug */ -/* See: https://github.com/patternfly/patternfly-next/issues/2325 */ -.pf-c-table td { - word-break: normal; - overflow-wrap: break-word; -} - -/* WORKAROUND: Dropdown (PF4): Caret is not properly aligned bug */ -/* See: https://github.com/patternfly/patternfly/issues/2715 */ -/* Align the icons inside of all dropdown toggles. */ -/* Part 1 of 2 */ -.pf-c-dropdown__toggle-button { - display: flex; - align-items: center; -} - -/* Make split button dropdowns the same height as their sibling. */ -/* Part 2 of 2 */ -.pf-m-split-button { - align-items: stretch; -} - -/* WORKAROUND: Navigation problems with Tertiary Nav widget on mobile */ -/* See: https://github.com/patternfly/patternfly-design/issues/840 */ -/* Helper mod to wrap pf-c-nav__tertiary */ -.ct-m-nav__tertiary-wrap { - flex-wrap: wrap; - - .pf-c-nav__scroll-button { - display: none; - } -} - -/* Helper mod to center pf-c-nav__tertiary when it wraps */ -.ct-m-nav__tertiary-center { - justify-content: center; -}