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

feat(scaffold): refactor to use tokens and grid areas #527

Merged
merged 5 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dev/pages/scaffold/scaffold.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="demo-container">
<forge-scaffold stretch class="app-full-scaffold">
<forge-scaffold class="app-full-scaffold">
<div slot="left" class="placeholder-container">Left</div>
<div slot="right" class="placeholder-container">Right</div>
<div slot="header" class="placeholder-container">Header</div>
Expand Down
13 changes: 13 additions & 0 deletions src/lib/core/styles/tokens/scaffold/_tokens.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@use 'sass:map';
@use '../../utils';

$tokens: (
height: utils.module-val(scaffold, height, 100%),
width: utils.module-val(scaffold, width, 100%),
overflow: utils.module-val(scaffold, overflow, hidden),
body-position: utils.module-val(scaffold, body-position, relative),
) !default;

@function get($key) {
@return map.get($tokens, $key);
}
93 changes: 93 additions & 0 deletions src/lib/scaffold/_core.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
@use './token-utils' as *;

@forward './token-utils';

@mixin host {
display: block;

width: #{token(width)};
height: #{token(height)};
}

@mixin base {
position: relative;

display: grid;
grid-template-areas:
'left header right'
'left body right'
'left footer right';
grid-template-rows: auto 1fr auto;
grid-template-columns: auto 1fr auto;

height: #{token(height)};
width: #{token(width)};

overflow: #{token(overflow)};
}

@mixin header {
grid-area: header;
min-width: 0;
min-height: 0;
}

@mixin body {
position: #{token(body-position)};

display: grid;
grid-area: body;
grid-template-areas:
'body-left body-header body-right'
'body-left body-inner body-right'
'body-left body-footer body-right';
grid-template-rows: auto 1fr auto;
grid-template-columns: auto 1fr auto;

width: #{token(width)};
min-width: 0;
min-height: 0;
overflow: hidden;
}

@mixin footer {
grid-area: footer;
}

@mixin body-header {
grid-area: body-header;
}

@mixin body-inner {
overflow: auto;
grid-area: body-inner;
}

@mixin body-footer {
grid-area: body-footer;
}

@mixin scrollable {
overflow: auto;
}

@mixin body-left {
grid-area: body-left;
}

@mixin body-right {
grid-area: body-right;
}

@mixin left {
grid-area: left;
}

@mixin right {
grid-area: right;
}

@mixin slotted-base {
min-width: 0;
min-height: 0;
}
189 changes: 0 additions & 189 deletions src/lib/scaffold/_mixins.scss

This file was deleted.

25 changes: 25 additions & 0 deletions src/lib/scaffold/_token-utils.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@use '../core/styles/tokens/scaffold/tokens';
@use '../core/styles/tokens/token-utils';

$_module: scaffold;
$_tokens: tokens.$tokens;

@mixin provide-theme($theme) {
@include token-utils.provide-theme($_module, $_tokens, $theme);
}

@function token($name, $type: token) {
@return token-utils.token($_module, $_tokens, $name, $type);
}

@function declare($token) {
@return token-utils.declare($_module, $token);
}

@mixin override($token, $token-or-value, $type: token) {
@include token-utils.override($_module, $_tokens, $token, $token-or-value, $type);
}

@mixin tokens($includes: null, $excludes: null) {
@include token-utils.tokens($_module, $_tokens, $includes, $excludes);
}
7 changes: 0 additions & 7 deletions src/lib/scaffold/build.json

This file was deleted.

38 changes: 0 additions & 38 deletions src/lib/scaffold/forge-scaffold.scss

This file was deleted.

1 change: 1 addition & 0 deletions src/lib/scaffold/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@forward './core';
1 change: 0 additions & 1 deletion src/lib/scaffold/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { defineCustomElement } from '@tylertech/forge-core';

import { ScaffoldComponent } from './scaffold';

export * from './scaffold-constants';
Expand Down
Loading
Loading