Skip to content

Commit

Permalink
use rem instead of em
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-page committed Apr 27, 2022
1 parent 2f308b1 commit af03a35
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 58 deletions.
6 changes: 3 additions & 3 deletions polaris.shopify.com/src/components/Button/Button.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.Button {
appearance: none;
background: #fbfbfb;
padding: 0.3em 0.5em 0.35em;
padding: 0.3rem 0.5rem 0.35rem;
border: none;
font-weight: var(--font-weight-400);
border-radius: var(--border-radius-200);
Expand All @@ -17,8 +17,8 @@

&.pill {
border-radius: 100px;
padding-left: 0.75em;
padding-right: 0.75em;
padding-left: 0.75rem;
padding-right: 0.75rem;
}

&[aria-pressed="true"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
}

.ComponentsNav {
padding: 2em;
padding: 2rem;

ul {
flex: 1;
display: grid;
margin: 0 -1em;
margin: 0 -1rem;
grid-template-columns: repeat(5, 1fr);

@media screen and (max-width: 2400px) {
Expand All @@ -41,9 +41,9 @@
position: relative;
display: flex;
flex-direction: column;
padding: 1em;
padding: 1rem;
border-radius: var(--border-radius-700);
gap: 0.75em;
gap: 0.75rem;
color: inherit;
transition: background-color 0.05s linear;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.GlobalSearch {
padding-left: 1rem;
input {
background: #ffffff url(./SearchMajor.svg) no-repeat 1em center;
background: #ffffff url(./SearchMajor.svg) no-repeat 1rem center;
background-size: 16px auto;

&::-webkit-search-decoration,
Expand All @@ -17,7 +17,7 @@
position: absolute;
z-index: 1;
border-radius: var(--border-radius-500);
width: 30em;
width: 30rem;
animation: search-results-enter 0.3s cubic-bezier(0.25, 1, 0.5, 1) both;
transform-origin: 0 0;
overflow: auto;
Expand All @@ -26,7 +26,7 @@
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.025), 0 0 20px rgba(0, 0, 0, 0.025),
0 50px 100px rgba(0, 0, 0, 0.1);
background: #ffffff;
padding: 1.75rem 0.5em 1.25rem;
padding: 1.75rem 0.5rem 1.25rem;

&:empty {
display: none;
Expand Down Expand Up @@ -72,7 +72,7 @@

.Excerpt {
margin: 0;
font-size: 0.8em;
font-size: 0.8rem;
display: flex;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}

.Filter {
padding: 2em;
padding: 2rem;

.TextField {
margin-top: 1.75rem;
Expand All @@ -22,7 +22,7 @@
.IconGrid {
display: grid;
margin-top: 20px;
margin-bottom: 3em;
margin-bottom: 3rem;
flex: 1;
gap: 2px;
padding: 0 0 0 2px;
Expand All @@ -35,6 +35,7 @@
at any resolution.
*/
grid-template-columns: repeat(9, 1fr);

@media screen and (max-width: 2400px) {
grid-template-columns: repeat(8, 1fr);
}
Expand Down Expand Up @@ -89,15 +90,15 @@
.Preview {
display: flex;
justify-content: center;
padding: 3em 0;
padding: 3rem 0;
animation: icon-in 0.25s 0.05s ease both;
}

.IconMeta {
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: 3em;
padding-bottom: 3rem;

p {
max-width: 60%;
Expand All @@ -106,24 +107,24 @@
}

.Sidebar {
width: 28em;
width: 28rem;
animation: sidebar-enter 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.SidebarInner {
animation: sidebar-inner-enter 0.3s 0.3s linear both;
padding: 2em;
padding: 2rem;
}

.Tabs {
display: flex;
margin-bottom: 1em;
margin-bottom: 1rem;
box-shadow: inset 0 -1px #dddddd;
}

.Tab {
position: relative;
padding: 1.25em 1em;
padding: 1.25rem 1rem;
flex: 1;
cursor: pointer;
background: transparent;
Expand Down Expand Up @@ -157,7 +158,7 @@
}

100% {
width: 28em;
width: 28rem;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

li {
list-style-type: disc;
margin-left: 1.1em;
margin-left: 1.1rem;
}

h1,
Expand Down Expand Up @@ -39,7 +39,7 @@
}

h4 {
margin-top: 1.5em;
margin-top: 1.5rem;
}

hr {
Expand All @@ -50,7 +50,7 @@
font-family: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono",
Menlo, Consolas, monospace;
font-size: var(--font-size-300);
padding: 1em;
padding: 1rem;
background: var(--text);
color: var(--surface);
border-radius: var(--border-radius-200);
Expand Down
6 changes: 3 additions & 3 deletions polaris.shopify.com/src/components/Nav/Nav.module.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.Nav {
flex: 1;
font-size: var(--font-size-300);
padding: 2em;
min-width: 16em;
padding: 2rem;
min-width: 16rem;
border-right: 1px solid #ededed;

span {
Expand All @@ -13,7 +13,7 @@
position: relative;
display: inline-block;
padding: 1px 0;
padding-left: 1.2em;
padding-left: 1.2rem;
color: var(--text-subdued);

&:hover {
Expand Down
16 changes: 8 additions & 8 deletions polaris.shopify.com/src/components/Page/Page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
align-items: center;
font-weight: var(--font-weight-500);
color: inherit;
gap: 1em;
margin: 1em 1em 1.75em;
gap: 1rem;
margin: 1rem 1rem 1.75rem;

p {
margin: 0;
}
}

.HeaderMain {
padding: 1em 2em 1em 1em;
width: 16em;
padding: 1rem 2rem 1rem 1rem;
width: 16rem;
background: #fafafa;

li a {
position: relative;
display: flex;
align-items: center;
height: 100%;
padding: 0.66em 1rem;
padding: 0.66rem 1rem;
color: inherit;
gap: 1em;
gap: 1rem;
font-weight: var(--font-weight-500);
}
}
Expand All @@ -57,6 +57,6 @@
}

.MainContent {
margin: 4em auto;
max-width: 42em;
margin: 4rem auto;
max-width: 42rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
padding: 0.75rem 0.6rem 0.75rem 2.75rem;
width: 100%;
border-radius: var(--border-radius-300);
background: url(./FilterMajor.svg) no-repeat 1em center;
background: url(./FilterMajor.svg) no-repeat 1rem center;
background-size: 16px auto;
border: 1px solid #dddddd;
border-top-color: #aaaaaa;
Expand Down
8 changes: 4 additions & 4 deletions polaris.shopify.com/src/components/Token/Token.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
width: 100%;
display: flex;
align-items: center;
gap: 1em;
margin-bottom: 1em;
gap: 1rem;
margin-bottom: 1rem;

&:last-child {
margin-bottom: 0;
Expand Down Expand Up @@ -52,13 +52,13 @@
font-size: var(--font-size-200);
background: var(--surface-token);
color: var(--text-token);
padding: 0.25em 0.75em;
padding: 0.25rem 0.75rem;
border-radius: var(--border-radius-200);
text-align: left;
}

.Token .Description {
margin: 0;
width: 50%;
font-size: 0.8em;
font-size: 0.8rem;
}
38 changes: 19 additions & 19 deletions polaris.shopify.com/src/styles/globals.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
--nav-width: 18em;
--nav-width: 18rem;
--narrow-content-width: 720px;
--focus-outline: 0 0 0 2px black;

Expand All @@ -15,24 +15,24 @@
--surface-token: #fdf0fd;
--primary: #008060;

--font-size-100: 0.75em;
--font-size-200: 0.8em;
--font-size-300: 0.95em;
--font-size-400: 1em;
--font-size-500: 1.1em;
--font-size-600: 1.2em;
--font-size-700: 1.33em;
--font-size-800: 2em;
--font-size-900: 4em;
--font-size-1000: 7em;
--font-size-100: 0.75rem;
--font-size-200: 0.8rem;
--font-size-300: 0.95rem;
--font-size-400: 1rem;
--font-size-500: 1.1rem;
--font-size-600: 1.2rem;
--font-size-700: 1.33rem;
--font-size-800: 2rem;
--font-size-900: 4rem;
--font-size-1000: 7rem;

--font-weight-400: 400;
--font-weight-500: 500;
--font-weight-600: 600;

--letter-spacing-100: -0.03em;
--letter-spacing-200: -0.02em;
--letter-spacing-300: -0.01em;
--letter-spacing-100: -0.03rem;
--letter-spacing-200: -0.02rem;
--letter-spacing-300: -0.01rem;
--letter-spacing-400: 0;

--border-radius-100: 0;
Expand Down Expand Up @@ -89,14 +89,14 @@ h1 {
font-size: var(--font-size-900);
font-weight: var(--font-weight-600);
line-height: 1.1;
letter-spacing: -0.03em;
letter-spacing: -0.03rem;
}

h2 {
font-size: var(--font-size-800);
font-weight: var(--font-weight-400);
line-height: 1.2;
letter-spacing: -0.0125em;
letter-spacing: -0.0125rem;
}

h3 {
Expand Down Expand Up @@ -125,10 +125,10 @@ h4 {
// Legacy CSS from old site (used in markdown files)
.usage-list {
margin: 1.25rem 0;
font-size: 0.9em;
font-size: 0.9rem;
display: flex;
flex-direction: column;
gap: 1em;
gap: 1rem;

.usage-list-part {
flex: 1;
Expand All @@ -141,7 +141,7 @@ h4 {
}

p {
margin-top: 0.5em;
margin-top: 0.5rem;
}
}

Expand Down

0 comments on commit af03a35

Please sign in to comment.