Skip to content

Add styles/variables for two-column block - #60

Merged
xitij2000 merged 1 commit into
wgu-release/ulmofrom
samuel/two-column-styles
May 21, 2026
Merged

Add styles/variables for two-column block#60
xitij2000 merged 1 commit into
wgu-release/ulmofrom
samuel/two-column-styles

Conversation

@samuelallan72

@samuelallan72 samuelallan72 commented May 18, 2026

Copy link
Copy Markdown
Member

Description

Add styles and variables used by the two-column block. See opencraft/dev/exemplar-blocks!28 for how this is used.

Testing instructions

See opencraft/dev/exemplar-blocks!28

Supporting information

Private-ref: https://tasks.opencraft.com/browse/BB-10774

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting it in tokens/core will add the prefix "pgn". Instead you should put it in apps/two-column/file.toml to not get a prefix. More here: https://github.com/openedx/paragon/tree/release-23.x/tokens#application-tokens

This is a very recent addition to paragon, just a week or two old!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xitij2000 ah cool, good to know thanks 👍

@samuelallan72 samuelallan72 May 20, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xitij2000 unfortunately it doesn't work - if I move core/two-column-block.toml to apps/two-column-block/main.toml, I get this error:

two.column.block.image.size.border.radius.lg.$value tries to reference wgu.size.border.radius.m, which is not defined.
two.column.block.image.size.border.radius.sm.$value tries to reference wgu.size.border.radius.xs, which is not defined.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this seems to be a shortcoming of Paragon. I've contributed a fix here: openedx/paragon#4303

The issue is that paragon only looks at its own token set for tokens in the apps directory, so it doesn't see any custom tokens in our theme and considers it an error if we use them.

You can kind of solve this by using the css variable value, i.e.:

[two-column-block.image.size.border.radius]
"$value" = "var(--pgn-wgu-size-border-radius.m)"

Note: While the output variable will be the same, you should use "two-column-block...." rather than "two.column.block..." since "two-column-block" is an entity of its own.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xitij2000 ah nice, thanks!

Note: While the output variable will be the same, you should use "two-column-block...." rather than "two.column.block..." since "two-column-block" is an entity of its own.

Ah got it, that makes sense. I'll update that here. :)

Comment thread tokens/core/typography.toml Outdated
"$value" = "700"

[typography.btn.line.height.base]
"$value" = "1.5rem"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not have rem, it should be unitless.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm unitless doesn't actually work, as it auto-adds a px postfix:

diff --git a/paragon/css/core/variables.css b/paragon/css/core/variables.css
index 2ba1ced..f551784 100644
--- a/paragon/css/core/variables.css
+++ b/paragon/css/core/variables.css
@@ -301,7 +301,7 @@
   --pgn-typography-badge-font-size: 75%;
   --pgn-typography-btn-font-size-base: 1rem;
   --pgn-typography-btn-font-weight: 700;
-  --pgn-typography-btn-line-height-base: 1.5rem;
+  --pgn-typography-btn-line-height-base: 1.5px;
   --pgn-typography-dropdown-item-text-decoration: none;
   --pgn-typography-image-figure-caption-font-size: 90%;
   --pgn-typography-menu-select-btn-link-text-decoration-line: underline;
diff --git a/tokens/core/typography.toml b/tokens/core/typography.toml
index c970ddc..527af90 100644
--- a/tokens/core/typography.toml
+++ b/tokens/core/typography.toml
@@ -32,4 +32,4 @@
 "$value" = "700"
 
 [typography.btn.line.height.base]
-"$value" = "1.5rem"
+"$value" = "1.5"

Also, either way the value set for typography.btn.line.height.base is ignored, because --pgn-typography-btn-line-height-base: var(--pgn-typography-input-btn-line-height-base); is output to variables.css further down in the file.

So I can't override the button line height. Bug in paragon? @xitij2000

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I dropped the button line-height. The default I think is close enough for now. There are higher priority things to tackle.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelallan72 Ah! I completely missed this but it should be typography.btn.line-height.base and not typography.btn.line.height.base. i.e. it should be line-height with a dash in the middle and not line.height The issue is they both result in the same output variable. Once make this change, both the issues will be resolved.

It's duplicating the variable since the two inputs are different variables, but they output to the same final variable name.

As for the px issue. The correct path typography.btn.line-height.base has its type set to "number", whereas by default it's guessing the type to be "size" and automatically appending the px.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xitij2000 lol I see, thanks for picking that up!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish there was some way to warn about this. I've made a similar mistake and it was hard to catch, especially if you're starting with the variable name,

Comment thread paragon/_overrides.scss Outdated
Base automatically changed from kshitij/examplar to wgu-release/ulmo May 18, 2026 14:49
@samuelallan72
samuelallan72 force-pushed the samuel/two-column-styles branch 2 times, most recently from 7f8afd0 to 2a8c10c Compare May 20, 2026 02:32
@samuelallan72
samuelallan72 marked this pull request as ready for review May 20, 2026 02:35
@samuelallan72 samuelallan72 changed the title wip: updates for two-column styles and general fixes Add styles/variables for two-column block May 20, 2026
@samuelallan72
samuelallan72 requested a review from xitij2000 May 20, 2026 02:36
@xitij2000

Copy link
Copy Markdown
Member

@samuelallan72 I think we can merge this after the conflicts are resolved.

@samuelallan72
samuelallan72 force-pushed the samuel/two-column-styles branch from 24f41d4 to e5a7798 Compare May 20, 2026 21:46
@samuelallan72

Copy link
Copy Markdown
Member Author

side thought: it takes > 5 minutes to run npm run build:scss in this repo, which feels extremely slow. It would be nice to optimise this at some point. cc @xitij2000

@samuelallan72

samuelallan72 commented May 20, 2026

Copy link
Copy Markdown
Member Author

@xitij2000 I've rebased, fixed the conflicts, and addressed your comments :) Would you mind leaving an approval if you're still happy with it?

@xitij2000
xitij2000 merged commit ebfeeba into wgu-release/ulmo May 21, 2026
1 check passed
@xitij2000
xitij2000 deleted the samuel/two-column-styles branch May 21, 2026 03:31
@xitij2000

Copy link
Copy Markdown
Member

@samuelallan72 Approved and merged!

For speeding up the build, we can use --source-tokens-only This is what the watch mode used during development to make the changes almost instant. I think that output that produces should be equivalent in our use-case, that should run in seconds since it'll only process the tokens we add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants