Skip to content

Commit

Permalink
refactor: deleted old logic to search SCSS variables
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Mar 15, 2023
1 parent 56ccf7b commit 5047353
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 154 deletions.
2 changes: 1 addition & 1 deletion scss/core/css/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
--pgn-color-btn-focus-bg-inverse-outline-info: inherit;
--pgn-color-btn-focus-bg-outline-info: inherit;
--pgn-color-btn-focus-bg-inverse-outline-dark: inherit;
--pgn-color-btn-focus-bg-outline-dark: unset;
--pgn-color-btn-focus-bg-outline-dark: inherit;
--pgn-color-btn-focus-bg-inverse-outline-danger: inherit;
--pgn-color-btn-focus-bg-outline-danger: inherit;
--pgn-color-btn-focus-bg-inverse-outline-brand: inherit;
Expand Down
1 change: 0 additions & 1 deletion src/CloseButton/CloseButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ button.close {
a.close.disabled {
pointer-events: none;
}

1 change: 0 additions & 1 deletion src/Code/Code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ pre {
max-height: var(--pgn-size-code-pre-scrollable-max-height);
overflow-y: scroll;
}

1 change: 0 additions & 1 deletion src/Dropdown/dropdown-bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@
display: block;
}


.dropdown-header {
display: block;
padding: var(--pgn-spacing-dropdown-padding-header);
Expand Down
12 changes: 1 addition & 11 deletions www/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const css = require('css');

const fs = require('fs');
const { INSIGHTS_PAGES } = require('./src/config');
const { getThemesSCSSVariables, processComponentSCSSVariables } = require('./theme-utils');

exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
Expand Down Expand Up @@ -97,14 +96,10 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
// Create component detail pages.
const components = result.data.allMdx.edges;

const themesSCSSVariables = await getThemesSCSSVariables();

// you'll call `createPage` for each result
// eslint-disable-next-line no-restricted-syntax
for (const { node } of components) {
const componentDir = node.slug.split('/')[0];
const variablesPath = path.resolve(__dirname, `../src/${componentDir}/_variables.scss`);
let scssVariablesData = {};
const cssVariablesData = [];

const pathToComponents = fs.readdirSync(`../src/${componentDir}`);
Expand All @@ -122,11 +117,6 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
}
});

if (fs.existsSync(variablesPath)) {
// eslint-disable-next-line no-await-in-loop
scssVariablesData = await processComponentSCSSVariables(variablesPath, themesSCSSVariables);
}

createPage({
// This is the slug you created before
// (or `node.frontmatter.slug`)
Expand All @@ -136,7 +126,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
// You can use the values in this context in
// our page layout component
context: {
id: node.id, components: node.frontmatter.components || [], scssVariablesData, cssVariablesData,
id: node.id, components: node.frontmatter.components || [], cssVariablesData,
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion www/src/templates/component-page-template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function PageTemplate({

const getTocData = () => {
const tableOfContents = JSON.parse(JSON.stringify(mdx.tableOfContents));
if (cssVariablesData.length && !tableOfContents.items?.includes()) {
if (cssVariablesData?.length && !tableOfContents.items?.includes()) {
tableOfContents.items?.push({
title: cssVariablesTitle,
url: `#${cssVariablesUrl}`,
Expand Down
138 changes: 0 additions & 138 deletions www/theme-utils.js

This file was deleted.

0 comments on commit 5047353

Please sign in to comment.