Skip to content

Commit

Permalink
Add proper css vars to user style config (#2105)
Browse files Browse the repository at this point in the history
  • Loading branch information
benhalpern committed Mar 18, 2019
1 parent 2658185 commit 2b2ecaa
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 33 deletions.
3 changes: 3 additions & 0 deletions app/assets/stylesheets/article-show.scss
Expand Up @@ -86,6 +86,7 @@ article {
box-shadow: var(--theme-container-box-shadow, $bold-shadow);
@media screen and (min-width: 880px) {
border: 1px solid darken($light-medium-gray, 2%);
border: var(--theme-container-border, 1px solid darken($light-medium-gray, 2%));
}
@media screen and (min-width: 950px) {
border-radius: 3px;
Expand Down Expand Up @@ -173,6 +174,7 @@ article {
padding: 0px 3px 16px;
font-weight: 500;
color: $medium-gray;
color: var(--theme-secondary-color, $medium-gray);
font-size: 13.5px;
line-height: 1.5em;
@media screen and (min-width: 430px) {
Expand All @@ -190,6 +192,7 @@ article {
}
a {
color: $medium-gray;
color: var(--theme-secondary-color, $medium-gray);
text-decoration: none;
}
.icon-img {
Expand Down
11 changes: 10 additions & 1 deletion app/assets/stylesheets/articles.scss
Expand Up @@ -217,7 +217,7 @@
box-shadow: $bold-shadow;
box-shadow: var(--theme-container-box-shadow, $bold-shadow);
border-radius: 3px;
width: 94%;
width: 96%;
margin: auto;
position: relative;
@media screen and (min-width: 950px) {
Expand Down Expand Up @@ -415,6 +415,7 @@
text-overflow: ellipsis;
a {
color: #666666;
color: var(--theme-secondary-color, #666666);
}
@media screen and (min-width: 430px) {
bottom: 90px;
Expand Down Expand Up @@ -582,6 +583,7 @@
font-size: 14px;
a {
color: #666666;
color: var(--theme-secondary-color, #666666);
}
&:hover {
opacity: 0.9;
Expand All @@ -608,6 +610,7 @@
}
.tag {
color: $black;
color: var(--theme-color, $black);
margin-right: 3px;
}
left: 62px;
Expand All @@ -627,6 +630,7 @@
font-weight: 600;
z-index: 8;
color: darken($medium-gray, 5%);
color: var(--theme-secondary-color, darken($medium-gray, 5%));
}
.article-engagement-count {
font-size: 13px;
Expand Down Expand Up @@ -912,6 +916,7 @@
font-weight: 500;
font-size: 0.9em;
background: darken($light-gray, 4%);
background: var(--theme-background, darken($light-gray, 4%));
a {
color: $black;
}
Expand Down Expand Up @@ -1165,6 +1170,7 @@
margin: 10px auto;
width: 92%;
color: $dark-gray;
color: var(--theme-secondary-color, $dark-gray);
.sponsor-learn-more {
display: block;
margin: 8px auto;
Expand Down Expand Up @@ -1196,6 +1202,7 @@
padding-bottom: 8px;
a {
color: $black;
color: var(--theme-color, $black);
font-weight: 500;
}
}
Expand Down Expand Up @@ -1342,7 +1349,9 @@
padding: 8px 0px;
font-size: 0.93em;
color: darken($sky-blue, 17%);
color: var(--theme-color, darken($sky-blue, 17%));
background: white;
background: var(--theme-container-background, #fff);
display: block;
width: 92%;
text-align: left;
Expand Down
6 changes: 5 additions & 1 deletion app/assets/stylesheets/comments.scss
Expand Up @@ -525,7 +525,6 @@ a.header-link {
padding-bottom: 5px;
margin: 0;
width: 96%;
color: $black;
font-size: 0.95em;
line-height: 1.35em;
overflow: hidden;
Expand Down Expand Up @@ -653,6 +652,7 @@ a.header-link {
border-top-left-radius: 3px;
border-top-left-radius: 3px;
color: $dark-gray;
color: var(--theme-secondary-color, $dark-gray);
position: relative;
// background:$light-gray;
.comment-date {
Expand All @@ -664,6 +664,7 @@ a.header-link {
text-align: right;
a {
color: $medium-gray;
color: var(--theme-secondary-color, $dark-gray);
}
}
.dropbtn {
Expand Down Expand Up @@ -757,6 +758,7 @@ a.header-link {
}
a {
color: lighten($dark-gray, 3%);
color: var(--theme-secondary-color, $dark-gray);
}
}
.reaction-button,
Expand Down Expand Up @@ -929,6 +931,7 @@ a.header-link {
padding: 0px;
border: 1px solid $light-medium-gray;
background: white;
background: var(--theme-container-background, #fff);
&.comment-created-via-fetch {
animation: comment-create 1.2s;
.body {
Expand Down Expand Up @@ -971,5 +974,6 @@ a.header-link {
}
to {
background-color: white;
background-color: var(--theme-container-background, #fff);
}
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/footer.scss
Expand Up @@ -17,6 +17,7 @@ footer{
}
a{
color: $black;
color: var(--theme-color, $black);
display:inline-block;
margin-right: 12px;
&:hover{
Expand All @@ -26,7 +27,9 @@ footer{
.inner-footer-container{
max-width: 820px;
background: $tan;
background: var(--theme-container-background, $tan);
border: 1px solid darken($light-medium-gray, 2%);
border: var(--theme-container-border, 1px solid darken($light-medium-gray, 2%));
box-shadow: $bold-shadow;
box-shadow: var(--theme-container-box-shadow, $bold-shadow);
padding:50px 30px;
Expand Down
5 changes: 5 additions & 0 deletions app/assets/stylesheets/index-comments.scss
Expand Up @@ -4,6 +4,7 @@
text-align:left;
padding-bottom:calc(0.6vw + 5px);
background:white;
background: var(--theme-container-background, white);
border-radius:3px;
border:1px solid $outline-color;
border: var(--theme-container-border, 1px solid $outline-color);
Expand All @@ -25,6 +26,7 @@
a{
padding:5px 10px;
color:$dark-gray;
color: var(--theme-color, $dark-gray);
font-weight:500;
font-size:0.85em;
}
Expand All @@ -44,6 +46,7 @@
}
a{
color:$black;
color: var(--theme-color, $black);
display:block;
padding-left:13px;
padding-right:13px;
Expand All @@ -59,13 +62,15 @@
.comment-date{
font-size:0.7em;
color:$medium-gray;
color: var(--theme-secondary-color, $medium-gray);
margin-left:5px;
vertical-align:2px;
display:inline-block;
}
.comment-preview{
font-size:0.9em;
color:$medium-gray;
color: var(--theme-secondary-color, $medium-gray);
}
@media screen and ( min-width: 430px ){
padding:5px 0px;
Expand Down
4 changes: 3 additions & 1 deletion app/assets/stylesheets/more-articles.scss
Expand Up @@ -9,7 +9,8 @@
margin-left: 25px;
}
a{
color:rgb(19, 19, 19);
color:$black;
color: var(--theme-color, $black);
}
.single-other-article{
width:94%;
Expand Down Expand Up @@ -58,6 +59,7 @@
margin:0;
font-weight:500;
color:lighten($medium-gray,4%);
color: var(--theme-secondary-color, lighten($medium-gray,4%));
font-size:1em;
@media screen and ( min-width: 480px ){
font-size:0.88em;
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/scaffolds.scss
Expand Up @@ -51,6 +51,7 @@ pre {

a {
color: $sky-blue;
color: var(--theme-secondary-color, $sky-blue);
text-decoration:none;
&:hover{
opacity:0.9;
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/settings.scss
Expand Up @@ -74,6 +74,7 @@
width: 210px;
display:inline-block;
color: $black;
color: var(--theme-color, $black);
&.selected {
background: $purple;
}
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/sticky-nav.scss
Expand Up @@ -37,6 +37,7 @@
.primary-sticky-nav-author-summary{
font-weight: 400;
color: $medium-gray;
color: var(--theme-secondary-color, $medium-gray);
padding: 10px 0px 5px;
font-style: italic;
font-size:0.88em;
Expand Down Expand Up @@ -117,6 +118,7 @@
margin-top:9px;
font-size: 0.8em;
color: $medium-gray;
color: var(--theme-secondary-color, $medium-gray);
}
&:hover{
border: 1px solid darken($light-medium-gray, 17%);
Expand All @@ -137,6 +139,7 @@
font-weight: 800;
margin-bottom: 2px;
color: $medium-gray;
color: var(--theme-secondary-color, $medium-gray);
}
.value{
display: inline-block;
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/top-bar.scss
Expand Up @@ -222,6 +222,7 @@
padding: 5px 10px;
text-align: left;
background: $tan;
background: var(--theme-top-bar-background, $tan);
border: 1px solid rgb(219, 222, 225);
border-top: 0px;
display: none;
Expand Down Expand Up @@ -260,10 +261,12 @@
}
&:hover {
background: darken($tan, 2%);
background: var(--theme-top-bar-background, darken($tan, 2%));
}
}
a {
color: $black;
color: var(--theme-color, $black);
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/user-profile-header.scss
Expand Up @@ -8,6 +8,7 @@
max-width:92%;
margin: 30px auto 20px;
background: white;
background: var(--theme-container-background, #fff);
border-radius: 3px;
@media screen and ( min-width: 950px ){
max-width:98%;
Expand Down Expand Up @@ -162,6 +163,7 @@
margin:0;
font-style: italic;
color:$medium-gray;
color: var(--theme-secondary-color, $medium-gray);
width: 94%;
font-size:0.9em;
margin-top:12px;
Expand Down Expand Up @@ -251,6 +253,7 @@
font-weight: 800;
margin-bottom: 2px;
color: $medium-gray;
color: var(--theme-secondary-color, $medium-gray);
}
.value{
display: inline-block;
Expand Down
33 changes: 10 additions & 23 deletions app/assets/stylesheets/variables.scss
Expand Up @@ -35,29 +35,6 @@ $bold-shadow: 3px 3px 0px darken($light-medium-gray, 13%);
$ease-in-cubic : cubic-bezier(0.55, 0.055, 0.675, 0.19);
$ease-out-cubic : cubic-bezier(0.215, 0.61, 0.355, 1);

body.night-theme {
#top-bar,
#page-content,
footer {
& {
background-color: #ececcc !important;

&,
& *:not(.highlight) > .highlight,
& iframe,
& video,
& img {
-webkit-filter: invert(100%);
filter: invert(100%);
}

& * {
background-blend-mode: difference;
}
}
}
}

body.sans-serif-article-body {
.body {
font-family: $helvetica;
Expand All @@ -67,3 +44,13 @@ body.sans-serif-article-body {
font-size: 0.98em;
}
}
body.comic-sans-article-body {
.body {
font-family: "Comic Sans MS", cursive, sans-serif;
}
.body p {
font-family: "Comic Sans MS", cursive, sans-serif;
font-size: 0.98em;
}

}
6 changes: 3 additions & 3 deletions app/models/user.rb
Expand Up @@ -114,10 +114,10 @@ class User < ApplicationRecord
message: "%{value} must be either v1 or v2" }

validates :config_theme,
inclusion: { in: %w(default night_theme),
inclusion: { in: %w[default night_theme],
message: "%{value} must be either default or night theme" }
validates :config_font,
inclusion: { in: %w(default sans_serif),
inclusion: { in: %w[default sans_serif comic_sans],
message: "%{value} must be either default or sans serif" }
validates :shipping_country,
length: { in: 2..2 },
Expand All @@ -131,7 +131,7 @@ class User < ApplicationRecord
length: { maximum: 500 }
validates :mentee_description, :mentor_description,
length: { maximum: 1000 }
validates :inbox_type, inclusion: { in: ["open", "private"] }
validates :inbox_type, inclusion: { in: %w[open private] }
validate :conditionally_validate_summary
validate :validate_mastodon_url
validate :validate_feed_url
Expand Down

0 comments on commit 2b2ecaa

Please sign in to comment.