Skip to content

Commit

Permalink
enhancement/issue 7 open props (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 authored May 3, 2024
1 parent b9ab8fc commit 5b50fac
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 62 deletions.
1 change: 1 addition & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '../src/styles/theme.css';
import '../src/styles/main.css';

/** @type { import('@storybook/web-components').Preview } */
const preview = {
Expand Down
232 changes: 189 additions & 43 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"postinstall": "patch-package"
},
"dependencies": {
"geist": "^1.2.0"
"geist": "^1.2.0",
"open-props": "^1.7.4"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.3.1",
Expand Down
20 changes: 18 additions & 2 deletions patches/@greenwood+cli+0.29.0.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@greenwood/cli/src/plugins/resource/plugin-standard-css.js b/node_modules/@greenwood/cli/src/plugins/resource/plugin-standard-css.js
index d52c723..2aedcc3 100644
index d52c723..73e64ee 100644
--- a/node_modules/@greenwood/cli/src/plugins/resource/plugin-standard-css.js
+++ b/node_modules/@greenwood/cli/src/plugins/resource/plugin-standard-css.js
@@ -5,10 +5,14 @@
Expand Down Expand Up @@ -60,7 +60,23 @@ index d52c723..2aedcc3 100644
} else if (type === 'Atrule' && name !== 'import') {
optimizedCss += `@${name} `;
} else if (type === 'TypeSelector') {
@@ -238,7 +272,7 @@ class StandardCssResource extends ResourceInterface {
@@ -54,6 +88,7 @@ function bundleCss(body, url, projectDirectory) {
case 'nth-last-child':
case 'nth-of-type':
case 'nth-last-of-type':
+ case 'where':
optimizedCss += '(';
break;
default:
@@ -163,6 +198,7 @@ function bundleCss(body, url, projectDirectory) {
case 'nth-last-child':
case 'nth-last-of-type':
case 'nth-of-type':
+ case 'where':
optimizedCss += ')';
break;
default:
@@ -238,7 +274,7 @@ class StandardCssResource extends ResourceInterface {

async optimize(url, response) {
const body = await response.text();
Expand Down
1 change: 1 addition & 0 deletions src/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<title>Greenwood</title>
<script type="module" src="../components/footer/footer.js" data-gwd-opt="static"></script>
<link rel="stylesheet" href="../styles/theme.css"></link>
<link rel="stylesheet" href="../styles/main.css"></link>
</head>

<body>
Expand Down
12 changes: 0 additions & 12 deletions src/stories/Styleguide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,6 @@ This is the font intended to be used for code samples.

<span class="typography typography-secondary">The quick brown fox jumped over the lazy dog.</span>

## Spacing

The whole website is built on an 8pt Grid, and spacing is always in multiples of 8px

### `--spacing-unit`

Adding a 40px spacing will look like this;
```css
.hero {
margin: calc(5 * var(--spacing-unit));
}
```

## Components

Expand Down
2 changes: 1 addition & 1 deletion src/stories/Techstack.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import { Meta } from '@storybook/addon-docs';
This project is built using the following technologies:

- Framework - [Greenwood](https://github.com/ProjectEvergreen/greenwood) + [WCC](https://github.com/ProjectEvergreen/wcc) (Web Components)
- Styling - Design Tokens provided by [**Open Props**](https://open-props.style/)
- Testing - [Web Test Runner](https://modern-web.dev/docs/test-runner/overview/)
- Styling - TBD
- Linting / Formatting - TBD
10 changes: 10 additions & 0 deletions src/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
h1 {
text-align: center;
}

footer {
text-align: center;
border-radius: var(--radius-4);
padding: var(--size-fluid-3);
box-shadow: var(--shadow-4);
}
8 changes: 5 additions & 3 deletions src/styles/theme.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@import "../../node_modules/open-props/src/props.borders.css";
@import "../../node_modules/open-props/src/props.shadows.css";
@import "../../node_modules/open-props/src/props.sizes.css";

@font-face {
font-family: "Geist-Sans";
src: url('../../node_modules/geist/dist/fonts/geist-sans/Geist-Regular.woff2') format("truetype");
Expand All @@ -19,12 +23,10 @@
--color-gray-background: #EDEFEC;
--font-primary: 'Geist-Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;;
--font-secondary: 'Geist-Mono', monospace;
--font-size-base: 16px;
--spacing-unit: 8px;
}

* {
font-family: var(--font-primary);
font-size: var(--font-size-base);
font-size: var(--size-px-3);
box-sizing: border-box;
}

0 comments on commit 5b50fac

Please sign in to comment.