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

refactor: new blockquotes styling + minor tweaks #157

Merged
merged 2 commits into from
Jul 27, 2021

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Jul 25, 2021

Currently, blockquotes are very similar to secondary alerts, so it would be good to make them more different in styling.
Similar to v1, we can take light yellow color as background, then current content color (black/white depending on color mode) and also remove border-radius (unlike in alerts). We'll end up with something like this:

Before After
image image

Beside this, as part of this PR, emphasis word is renamed to "foreground" (for better clarity), and removing increase of text decoration line at focus state, because it does not make much sense.

@lex111 lex111 requested a review from slorber July 25, 2021 08:56
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 25, 2021
@github-actions
Copy link

github-actions bot commented Jul 25, 2021

Size Change: +2.58 kB (0%)

Total Size: 582 kB

Filename Size Change
./packages/core/dist/css/default-dark/default-dark-rtl.css 84.5 kB +410 B (0%)
./packages/core/dist/css/default-dark/default-dark-rtl.min.css 59.3 kB +247 B (0%)
./packages/core/dist/css/default-dark/default-dark.css 84.5 kB +411 B (0%)
./packages/core/dist/css/default-dark/default-dark.min.css 59.2 kB +248 B (0%)
./packages/core/dist/css/default/default-rtl.css 83 kB +398 B (0%)
./packages/core/dist/css/default/default-rtl.min.css 58.1 kB +235 B (0%)
./packages/core/dist/css/default/default.css 82.9 kB +399 B (0%)
./packages/core/dist/css/default/default.min.css 58.1 kB +236 B (0%)
ℹ️ View Unchanged
Filename Size
./packages/core/dist/js/alerts.js 409 B
./packages/core/dist/js/alerts.min.js 409 B
./packages/core/dist/js/button-groups.js 267 B
./packages/core/dist/js/button-groups.min.js 267 B
./packages/core/dist/js/dropdowns.js 1.01 kB
./packages/core/dist/js/dropdowns.min.js 1.01 kB
./packages/core/dist/js/menu.js 1.94 kB
./packages/core/dist/js/menu.min.js 1.94 kB
./packages/core/dist/js/navbar.js 1.08 kB
./packages/core/dist/js/navbar.min.js 1.08 kB
./packages/core/dist/js/pills.js 270 B
./packages/core/dist/js/pills.min.js 270 B
./packages/core/dist/js/radio-behavior.js 705 B
./packages/core/dist/js/radio-behavior.min.js 705 B
./packages/core/dist/js/tabs.js 267 B
./packages/core/dist/js/tabs.min.js 267 B

compressed-size-action

@github-actions
Copy link

github-actions bot commented Jul 25, 2021

Dist CSS Diff

diff --git a/packages/core/dist/css/default/default.css b/packages/core/dist-branch/css/default/default.css
index 3235d0d..d4270d6 100644
--- a/packages/core/dist/css/default/default.css
+++ b/packages/core/dist-branch/css/default/default.css
@@ -39,10 +39,10 @@
   See also https://github.com/facebookincubator/infima/issues/55#issuecomment-884023075
    */
   --ifm-contrast-background-value: 90%;
-  --ifm-contrast-emphasis-value: 70%;
+  --ifm-contrast-foreground-value: 70%;
   /* Using slightly different values for dark mode */
   --ifm-contrast-background-dark-value: 70%;
-  --ifm-contrast-emphasis-dark-value: 90%;
+  --ifm-contrast-foreground-dark-value: 90%;
 
   --ifm-color-primary: #3578e5;
   --ifm-color-secondary: #ebedf0;
@@ -57,7 +57,7 @@
     --ifm-color-primary-lighter: rgb(114, 161, 237);
     --ifm-color-primary-lightest: rgb(154, 188, 242);
     --ifm-color-primary-contrast-background: rgb(235, 242, 252);
-    --ifm-color-primary-contrast-emphasis: rgb(16, 36, 69);
+    --ifm-color-primary-contrast-foreground: rgb(16, 36, 69);
     --ifm-color-secondary-dark: rgb(212, 213, 216);
     --ifm-color-secondary-darker: rgb(200, 201, 204);
     --ifm-color-secondary-darkest: rgb(164, 166, 168);
@@ -65,7 +65,7 @@
     --ifm-color-secondary-lighter: rgb(241, 242, 245);
     --ifm-color-secondary-lightest: rgb(245, 246, 248);
     --ifm-color-secondary-contrast-background: rgb(253, 253, 254);
-    --ifm-color-secondary-contrast-emphasis: rgb(71, 71, 72);
+    --ifm-color-secondary-contrast-foreground: rgb(71, 71, 72);
     --ifm-color-success-dark: rgb(0, 148, 0);
     --ifm-color-success-darker: rgb(0, 139, 0);
     --ifm-color-success-darkest: rgb(0, 115, 0);
@@ -73,7 +73,7 @@
     --ifm-color-success-lighter: rgb(77, 191, 77);
     --ifm-color-success-lightest: rgb(128, 210, 128);
     --ifm-color-success-contrast-background: rgb(230, 246, 230);
-    --ifm-color-success-contrast-emphasis: rgb(0, 49, 0);
+    --ifm-color-success-contrast-foreground: rgb(0, 49, 0);
     --ifm-color-info-dark: rgb(76, 179, 212);
     --ifm-color-info-darker: rgb(71, 169, 201);
     --ifm-color-info-darkest: rgb(59, 139, 165);
@@ -81,7 +81,7 @@
     --ifm-color-info-lighter: rgb(135, 216, 242);
     --ifm-color-info-lightest: rgb(170, 227, 246);
     --ifm-color-info-contrast-background: rgb(238, 249, 253);
-    --ifm-color-info-contrast-emphasis: rgb(25, 60, 71);
+    --ifm-color-info-contrast-foreground: rgb(25, 60, 71);
     --ifm-color-warning-dark: rgb(230, 167, 0);
     --ifm-color-warning-darker: rgb(217, 158, 0);
     --ifm-color-warning-darkest: rgb(179, 130, 0);
@@ -89,7 +89,7 @@
     --ifm-color-warning-lighter: rgb(255, 207, 77);
     --ifm-color-warning-lightest: rgb(255, 221, 128);
     --ifm-color-warning-contrast-background: rgb(255, 248, 230);
-    --ifm-color-warning-contrast-emphasis: rgb(77, 56, 0);
+    --ifm-color-warning-contrast-foreground: rgb(77, 56, 0);
     --ifm-color-danger-dark: rgb(225, 50, 56);
     --ifm-color-danger-darker: rgb(213, 48, 53);
     --ifm-color-danger-darkest: rgb(175, 39, 43);
@@ -97,7 +97,7 @@
     --ifm-color-danger-lighter: rgb(251, 116, 120);
     --ifm-color-danger-lightest: rgb(253, 156, 159);
     --ifm-color-danger-contrast-background: rgb(255, 235, 236);
-    --ifm-color-danger-contrast-emphasis: rgb(75, 17, 19);
+    --ifm-color-danger-contrast-foreground: rgb(75, 17, 19);
 
   --ifm-color-white: #fff;
   --ifm-color-black: #000;
@@ -193,7 +193,7 @@
   --ifm-heading-color: inherit;
   --ifm-heading-margin-top: 0;
   --ifm-heading-margin-bottom: var(--ifm-spacing-vertical);
-  --ifm-heading-font-family: inherit;
+  --ifm-heading-font-family: var(--ifm-font-family-base);
   --ifm-heading-font-weight: var(--ifm-font-weight-bold);
   --ifm-heading-line-height: 1.25;
 
@@ -235,19 +235,16 @@
   --ifm-paragraph-margin-bottom: var(--ifm-leading);
 
   /* Blockquotes. */
+  --ifm-blockquote-base-background: #ffe773;
   --ifm-blockquote-font-size: var(--ifm-font-size-base);
-  --ifm-blockquote-border-radius: var(--ifm-global-radius);
-  --ifm-blockquote-border-width: 0px; /* For users that want to easily add a border */
   --ifm-blockquote-border-left-width: 5px;
   --ifm-blockquote-color: var(--ifm-font-color-base);
   --ifm-blockquote-padding-horizontal: var(--ifm-spacing-horizontal);
   --ifm-blockquote-padding-vertical: var(--ifm-spacing-vertical);
   --ifm-blockquote-shadow: var(--ifm-global-shadow-lw);
-  --ifm-blockquote-background-color: var(
-    --ifm-color-secondary-contrast-background
-  );
-  --ifm-blockquote-emphasis-color: var(--ifm-color-secondary-contrast-emphasis);
-  --ifm-blockquote-border-color: var(--ifm-color-secondary-dark);
+  --ifm-blockquote-background-color: rgba(255, 231, 115, 0.2);
+  --ifm-blockquote-foreground-color: var(--ifm-font-color-base);
+  --ifm-blockquote-border-color: rgb(242, 219, 109);
 
   /* Horizontal Rules. */
   --ifm-hr-border-color: var(--ifm-color-emphasis-500);
@@ -1303,19 +1300,17 @@ p {
 
 blockquote {
   --ifm-code-background: rgba(235, 237, 240, 0.15);
-  --ifm-link-color: var(--ifm-blockquote-emphasis-color);
-  --ifm-link-hover-color: var(--ifm-blockquote-emphasis-color);
+  --ifm-link-color: var(--ifm-blockquote-foreground-color);
+  --ifm-link-hover-color: var(--ifm-blockquote-foreground-color);
   --ifm-link-decoration: underline;
 
   background-color: var(--ifm-blockquote-background-color);
   border-color: var(--ifm-blockquote-border-color);
   border-style: solid;
-  border-width: var(--ifm-blockquote-border-width);
+  border-width: 0;
   border-left-width: var(--ifm-blockquote-border-left-width);
-  border-radius: var(--ifm-blockquote-border-radius);
   box-shadow: var(--ifm-blockquote-shadow);
-  color: var(--ifm-blockquote-emphasis-color);
-
+  color: var(--ifm-blockquote-foreground-color);
   font-size: var(--ifm-blockquote-font-size);
   margin: 0 0 var(--ifm-spacing-vertical);
   padding: var(--ifm-blockquote-padding-vertical)
@@ -1335,8 +1330,7 @@ blockquote a {
             text-decoration-color: var(--ifm-blockquote-border-color);
   }
 
-blockquote a:hover,
-    blockquote a:focus {
+blockquote a:hover {
       text-decoration-thickness: 2px;
     }
 
@@ -1514,7 +1508,9 @@ hr:after {
         --ifm-color-primary-contrast-background
       );
       --ifm-alert-background-color-highlight: rgba(53, 120, 229, 0.15);
-      --ifm-alert-emphasis-color: var(--ifm-color-primary-contrast-emphasis);
+      --ifm-alert-foreground-color: var(
+        --ifm-color-primary-contrast-foreground
+      );
       --ifm-alert-border-color: var(--ifm-color-primary-dark);
     }
 
@@ -1523,7 +1519,9 @@ hr:after {
         --ifm-color-secondary-contrast-background
       );
       --ifm-alert-background-color-highlight: rgba(235, 237, 240, 0.15);
-      --ifm-alert-emphasis-color: var(--ifm-color-secondary-contrast-emphasis);
+      --ifm-alert-foreground-color: var(
+        --ifm-color-secondary-contrast-foreground
+      );
       --ifm-alert-border-color: var(--ifm-color-secondary-dark);
     }
 
@@ -1532,7 +1530,9 @@ hr:after {
         --ifm-color-success-contrast-background
       );
       --ifm-alert-background-color-highlight: rgba(0, 164, 0, 0.15);
-      --ifm-alert-emphasis-color: var(--ifm-color-success-contrast-emphasis);
+      --ifm-alert-foreground-color: var(
+        --ifm-color-success-contrast-foreground
+      );
       --ifm-alert-border-color: var(--ifm-color-success-dark);
     }
 
@@ -1541,7 +1541,9 @@ hr:after {
         --ifm-color-info-contrast-background
       );
       --ifm-alert-background-color-highlight: rgba(84, 199, 236, 0.15);
-      --ifm-alert-emphasis-color: var(--ifm-color-info-contrast-emphasis);
+      --ifm-alert-foreground-color: var(
+        --ifm-color-info-contrast-foreground
+      );
       --ifm-alert-border-color: var(--ifm-color-info-dark);
     }
 
@@ -1550,7 +1552,9 @@ hr:after {
         --ifm-color-warning-contrast-background
       );
       --ifm-alert-background-color-highlight: rgba(255, 186, 0, 0.15);
-      --ifm-alert-emphasis-color: var(--ifm-color-warning-contrast-emphasis);
+      --ifm-alert-foreground-color: var(
+        --ifm-color-warning-contrast-foreground
+      );
       --ifm-alert-border-color: var(--ifm-color-warning-dark);
     }
 
@@ -1559,18 +1563,20 @@ hr:after {
         --ifm-color-danger-contrast-background
       );
       --ifm-alert-background-color-highlight: rgba(250, 56, 62, 0.15);
-      --ifm-alert-emphasis-color: var(--ifm-color-danger-contrast-emphasis);
+      --ifm-alert-foreground-color: var(
+        --ifm-color-danger-contrast-foreground
+      );
       --ifm-alert-border-color: var(--ifm-color-danger-dark);
     }
 
 .alert {
 
   --ifm-code-background: var(--ifm-alert-background-color-highlight);
-  --ifm-link-color: var(--ifm-alert-emphasis-color);
-  --ifm-link-hover-color: var(--ifm-alert-emphasis-color);
+  --ifm-link-color: var(--ifm-alert-foreground-color);
+  --ifm-link-hover-color: var(--ifm-alert-foreground-color);
   --ifm-link-decoration: underline;
-  --ifm-tabs-color: var(--ifm-alert-emphasis-color);
-  --ifm-tabs-color-active: var(--ifm-alert-emphasis-color);
+  --ifm-tabs-color: var(--ifm-alert-foreground-color);
+  --ifm-tabs-color-active: var(--ifm-alert-foreground-color);
   --ifm-tabs-color-active-border: var(--ifm-alert-border-color);
 
   background-color: var(--ifm-alert-background-color);
@@ -1580,12 +1586,32 @@ hr:after {
   border-left-width: var(--ifm-alert-border-left-width);
   border-radius: var(--ifm-alert-border-radius);
   box-shadow: var(--ifm-alert-shadow);
-  color: var(--ifm-alert-emphasis-color);
+  color: var(--ifm-alert-foreground-color);
   padding: var(--ifm-alert-padding-vertical) var(--ifm-alert-padding-horizontal);
 }
 
+.alert__heading {
+    align-items: center;
+    display: flex;
+    font: bold var(--ifm-h5-font-size) / var(--ifm-heading-line-height)
+      var(--ifm-heading-font-family);
+    margin-bottom: 0.5rem;
+    text-transform: uppercase;
+  }
+
+.alert__icon {
+    display: inline-flex;
+    margin-right: 0.4em;
+  }
+
+.alert__icon svg {
+      fill: var(--ifm-alert-foreground-color);
+      stroke: var(--ifm-alert-foreground-color);
+      stroke-width: 0;
+    }
+
 .alert .close {
-    color: var(--ifm-alert-emphasis-color);
+    color: var(--ifm-alert-foreground-color);
     margin: calc(var(--ifm-alert-padding-vertical) * -1)
       calc(var(--ifm-alert-padding-horizontal) * -1) 0 0;
 
@@ -1605,8 +1631,7 @@ hr:after {
             text-decoration-color: var(--ifm-alert-border-color);
   }
 
-.alert a:hover,
-    .alert a:focus {
+.alert a:hover {
       text-decoration-thickness: 2px;
     }
 
@@ -3012,21 +3037,23 @@ html[data-theme='dark'] {
 
   --ifm-code-background: rgb(51, 52, 55);
 
+  --ifm-blockquote-background-color: rgb(77, 69, 35);
+
   --ifm-scrollbar-track-background-color: #444444;
   --ifm-scrollbar-thumb-background-color: #686868;
   --ifm-scrollbar-thumb-hover-background-color: #7a7a7a;
     --ifm-color-primary-contrast-background: rgb(16, 36, 69);
-    --ifm-color-primary-contrast-emphasis: rgb(235, 242, 252);
+    --ifm-color-primary-contrast-foreground: rgb(235, 242, 252);
     --ifm-color-secondary-contrast-background: rgb(71, 71, 72);
-    --ifm-color-secondary-contrast-emphasis: rgb(253, 253, 254);
+    --ifm-color-secondary-contrast-foreground: rgb(253, 253, 254);
     --ifm-color-success-contrast-background: rgb(0, 49, 0);
-    --ifm-color-success-contrast-emphasis: rgb(230, 246, 230);
+    --ifm-color-success-contrast-foreground: rgb(230, 246, 230);
     --ifm-color-info-contrast-background: rgb(25, 60, 71);
-    --ifm-color-info-contrast-emphasis: rgb(238, 249, 253);
+    --ifm-color-info-contrast-foreground: rgb(238, 249, 253);
     --ifm-color-warning-contrast-background: rgb(77, 56, 0);
-    --ifm-color-warning-contrast-emphasis: rgb(255, 248, 230);
+    --ifm-color-warning-contrast-foreground: rgb(255, 248, 230);
     --ifm-color-danger-contrast-background: rgb(75, 17, 19);
-    --ifm-color-danger-contrast-emphasis: rgb(255, 235, 236)
+    --ifm-color-danger-contrast-foreground: rgb(255, 235, 236)
 }
 
 @media (min-width: 1440px) {

@netlify
Copy link

netlify bot commented Jul 25, 2021

✔️ Deploy Preview for infima ready!

🔨 Explore the source changes: 2fa7503

🔍 Inspect the deploy log: https://app.netlify.com/sites/infima/deploys/60fd42a7aad3dd0008436405

😎 Browse the preview: https://deploy-preview-157--infima.netlify.app/demo

@lex111
Copy link
Contributor Author

lex111 commented Jul 25, 2021

I also added markup and styles for alert heading. However, I'm not sure we need to add styles for SVG icon or/and markup for it at all to Infima codebase. Perhaps it's better to do it in the "remark-admonitions" plugin styles as like before?

image

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

👍 looks like changes we already agreed on

&:hover,
&:focus {

&:hover {
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh I see what you mean now, I thought you wanted to remove the :hover too

padding: var(--ifm-alert-padding-vertical) var(--ifm-alert-padding-horizontal);

&__heading {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I also added markup and styles for alert heading. However, I'm not sure we need to add styles for SVG icon or/and markup for it at all to Infima codebase. Perhaps it's better to do it in the "remark-admonitions" plugin styles as like before?

That seems fine to have it there, we can see later if we find a way to use those classes in the remark-admonitions plugin, or eventually remove this CSS if useless

@slorber slorber merged commit 7e3a1e5 into master Jul 27, 2021
@lex111 lex111 deleted the lex111/admotions-imp branch July 27, 2021 11:48
@dsmmcken
Copy link
Contributor

Didn't this just trade it looking like secondary-alerts to warning-alerts? I prefer this, but any reason to not just use the existing -warning colors rather than introduce three new yellow hardcodes? Related to #163
image

@slorber
Copy link
Collaborator

slorber commented Jul 30, 2021

The goal is to make quotes not look like alerts. We probably don't want to use the exact same color, on purpose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants