From 1f8bda6e6b3196f09b5318cb7920ce8e2cc7e2ca Mon Sep 17 00:00:00 2001 From: hinakhadim Date: Wed, 3 Apr 2024 10:27:05 +0500 Subject: [PATCH] feat: initial setup for dark theme --- package.json | 3 +++ paragon/_extras.scss | 0 paragon/_overrides.scss | 4 +++- postinstall.js | 31 +++++++++++++++++++++++++++++++ themes/dark/_variables.scss | 5 +++++ 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 paragon/_extras.scss create mode 100644 postinstall.js create mode 100644 themes/dark/_variables.scss diff --git a/package.json b/package.json index 1e1ec139..5e0db957 100644 --- a/package.json +++ b/package.json @@ -14,5 +14,8 @@ "homepage": "https://github.com/edly-io/brand-openedx#readme", "publishConfig": { "access": "public" + }, + "scripts": { + "postinstall": "node postinstall.js" } } diff --git a/paragon/_extras.scss b/paragon/_extras.scss new file mode 100644 index 00000000..e69de29b diff --git a/paragon/_overrides.scss b/paragon/_overrides.scss index 78a811e9..9bae9167 100644 --- a/paragon/_overrides.scss +++ b/paragon/_overrides.scss @@ -2775,4 +2775,6 @@ div[role=heading].h2 + .list-unstyled.m-0.mt-4.pt-2 { } } } -} \ No newline at end of file +} + +@import './extras'; diff --git a/postinstall.js b/postinstall.js new file mode 100644 index 00000000..1f69e8bd --- /dev/null +++ b/postinstall.js @@ -0,0 +1,31 @@ +const fs = require("fs"); +const path = require('path'); + +const themesSupported = ["dark"] +let theme = process.env.npm_config_theme; + +// INFO: writing copyDirectorySync instead of using fs-extra package because we don't want to have any npm dependency in brand-openedx +function copyDirectorySync(source, destination) { + if (!fs.existsSync(destination)) { + fs.mkdirSync(destination); + } + + const files = fs.readdirSync(source); + + files.forEach(file => { + const sourcePath = path.join(source, file); + const destPath = path.join(destination, file); + + if (fs.statSync(sourcePath).isDirectory()) { + copyDirectorySync(sourcePath, destPath); + } else { + fs.copyFileSync(sourcePath, destPath); + } + }); +} + +if (themesSupported.includes(theme)){ + const srcDir = path.resolve(__dirname, 'themes', theme); + const destDir = path.resolve(__dirname, 'paragon'); + copyDirectorySync(srcDir, destDir); +} diff --git a/themes/dark/_variables.scss b/themes/dark/_variables.scss new file mode 100644 index 00000000..b100baba --- /dev/null +++ b/themes/dark/_variables.scss @@ -0,0 +1,5 @@ +$primary: #15376D; +$primary-light: #F2F7F8; +$light-drak: #374151; + +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');