Some night theme code, other style adjustments, and extracted app name into ENV var (#2289)

* Style, theme adjustments, plus generalization work

* Modify login cta style on home page

* Modify text
This commit is contained in:
Ben Halpern 2019-04-02 13:10:28 -04:00 committed by GitHub
parent 512c9ee8a0
commit b0ad7f8c74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 82 additions and 54 deletions

View file

@ -10,6 +10,7 @@ enable_defaults! { ENV['RACK_ENV'] != 'production' }
# App domain + Protocol setting for development
variable :APP_DOMAIN, :String, default: "localhost:3000"
variable :APP_PROTOCOL, :String, default: "http://"
variable :COMMUNITY_NAME, :String, default: "DEV(local)"
# Logo
variable :LOGO_SVG, :String, default: ""

View file

@ -1,5 +1,5 @@
{
"name": "DEV Community",
"name": "<%= ApplicationConfig["COMMUNITY_NAME"] %> Community",
"short_name": "dev.to",
"description": "Where programmers share ideas, experiences, and help each other grow.",
"start_url": "/",

View file

@ -1065,9 +1065,17 @@
margin: 0;
}
&.signin-cta-widget {
background: lighten($purple, 3%);
border: 1px solid darken($bold-blue, 5%);
box-shadow: 5px 6px 0px darken($bold-blue, 15%);
padding: 0px 0px;
width: calc(100% - 6px);
header {
background: darken($bold-blue, 5%);
color: white;
padding: 15px 0px;
text-align: center;
font-weight: bold;
}
}
&.sponsorship-widget {
display: none;
@ -1372,22 +1380,26 @@
}
}
.cta-button {
margin-top: 8px;
padding: 8px 0px;
margin: 8px auto 0px;
padding: 10px 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);
border: 2px solid darken($sky-blue, 17%);
border: 2px solid var(--theme-color, darken($sky-blue, 17%));
display: block;
width: 92%;
text-align: left;
width: 85%;
text-align: center;
border-radius: 100px;
&.login-cta-button {
border-top: 0px;
color: $black;
font-size: 1.2em;
width: 100%;
font-size: 1.1em;
width: 85%;
background: lighten($purple, 3%);
margin: 20px 0px;
padding: 18px 0px;
}
&:hover {
text-decoration: underline;

View file

@ -30,6 +30,7 @@
padding-top: 20px;
h1 {
background: $yellow;
background: var(--theme-container-accent-background, $yellow);
}
}
}

View file

@ -93,7 +93,8 @@ pre{
background: $green;
font-family: $helvetica-condensed;
-webkit-appearance: none;
font-stretch:condensed;
font-stretch: condensed;
font-weight: bold;
}
button{

View file

@ -7,5 +7,6 @@
padding:1px 12px 1px;
margin:3px 1px;
color: $dark-medium-gray;
color: var(--theme-secondary-color, $dark-medium-gray);
font-family: $monospace;
}

View file

@ -40,10 +40,10 @@ module ApplicationHelper
end
def title(page_title)
derived_title = if page_title.include?("DEV")
derived_title = if page_title.include?(ApplicationConfig["COMMUNITY_NAME"])
page_title
else
page_title + " - DEV Community 👩‍💻👨‍💻"
page_title + " - #{ApplicationConfig['COMMUNITY_NAME']} Community 👩‍💻👨‍💻"
end
content_for(:title) { derived_title }
derived_title

View file

@ -27,7 +27,7 @@
</div>
<% end %>
<div class="sponsors-love-message">
We are grateful for wonderful sponsors who help sustain the DEV community.
We are grateful for wonderful sponsors who help sustain the <%= ApplicationConfig["COMMUNITY_NAME"] %> community.
</div>
<div class="sponsor-footer">
<p>
@ -50,9 +50,8 @@
</div>
<div class="side-footer">
<a href="/about">About</a>
<a href="/events">Events</a>
<a href="/sponsors">Sponsors</a>
<a href="https://shop.dev.to/">DEV Shop</a>
<a href="https://shop.dev.to/"><%= ApplicationConfig["COMMUNITY_NAME"] %> Shop</a>
<a href="/privacy">Privacy Policy</a>
<a href="/terms">Terms of Use</a>
<a href="/contact">Contact</a>

View file

@ -3,16 +3,16 @@
<div class="side-bar sidebar-additional showing" id="sidebar-additional">
<% unless user_signed_in? %>
<div class="widget signin-cta-widget">
<header>
<h4>DEV.TO(GETHER)</h4>
<header class="signin-cta-widget-header">
Join <%= ApplicationConfig["COMMUNITY_NAME"] %>
</header>
<div class="widget-body">
<center style="margin-bottom: 2px;">
<a href="/users/auth/twitter?callback_url=<%= ApplicationConfig["APP_PROTOCOL"] %><%= ApplicationConfig["APP_DOMAIN"] %>/users/auth/twitter/callback" class="cta cta-button login-cta-button" data-no-instant>
SIGN IN VIA TWITTER
Sign In With Twitter
</a>
<a href="/users/auth/github?state=navbar_basic" class="cta cta-button login-cta-button" data-no-instant>
SIGN IN VIA GITHUB
Sign In With GitHub
</a>
</center>
</div>

View file

@ -1,6 +1,6 @@
<%= content_for :page_meta do %>
<% title_with_timeframe(
page_title: "DEV Community 👩‍💻👨‍💻",
page_title: "#{ApplicationConfig['COMMUNITY_NAME']} Community 👩‍💻👨‍💻",
timeframe: params[:timeframe],
content_for: true,
) %>
@ -11,17 +11,17 @@
<meta property="og:type" content="website" />
<meta property="og:url" content="https://dev.to<%= request.path %>" />
<meta property="og:title" content="<%= title_with_timeframe(page_title: "The DEV Community", timeframe: params[:timeframe]) %>" />
<meta property="og:title" content="<%= title_with_timeframe(page_title: "The #{ApplicationConfig['COMMUNITY_NAME']} Community", timeframe: params[:timeframe]) %>" />
<meta property="og:image" content="https://thepracticaldev.s3.amazonaws.com/i/g355ol6qsrg0j2mhngz9.png">
<meta property="og:description" content="Where programmers share ideas and help each other grow." />
<meta property="og:site_name" content="The DEV Community" />
<meta property="og:site_name" content="The #{ApplicationConfig['COMMUNITY_NAME']} Community" />
<meta name="twitter:site" content="@ThePracticalDev">
<meta name="twitter:title" content="<%= title_with_timeframe(page_title: "The DEV Community", timeframe: params[:timeframe]) %>">
<meta name="twitter:title" content="<%= title_with_timeframe(page_title: "The #{ApplicationConfig['COMMUNITY_NAME']} Community", timeframe: params[:timeframe]) %>">
<meta name="twitter:description" content="Where programmers share ideas, experiences, and help each other grow.">
<meta name="twitter:image:src" content="https://thepracticaldev.s3.amazonaws.com/i/g355ol6qsrg0j2mhngz9.png">
<meta name="twitter:card" content="summary_large_image">
<%= auto_discovery_link_tag(:rss, "https://dev.to/feed", title: "The Practical Dev RSS Feed") %>
<%= auto_discovery_link_tag(:rss, "https://dev.to/feed", title: "#{ApplicationConfig['COMMUNITY_NAME']} RSS Feed") %>
<% end %>
<div class="home" id="index-container"
data-params="<%= params.to_json(only: %i[tag username q]) %>" data-which="<%= @list_of %>"
@ -33,7 +33,7 @@
<div class="on-page-nav-controls" id="on-page-nav-controls">
<div class="on-page-nav-label">
<div class="wide-nav-links">
<a class="nav-chronofiter-link <%= "selected" if ["week", "month", "year", "infinity", "latest"].exclude?(params[:timeframe]) %>" href="<%= list_path %>/">
<a class="nav-chronofiter-link <%= "selected" if %w[week month year infinity latest].exclude?(params[:timeframe]) %>" href="<%= list_path %>/">
FEED
</a>
<span class="separator"></span>
@ -56,7 +56,7 @@
</div>
<div class="narrow-nav-select" aria-label="feed-filter-select">
<% if ["week", "month", "year", "infinity", "latest"].exclude?(params[:timeframe]) %>
<button id="narrow-feed-butt">&lt;MY DEV FEED&gt;</button>
<button id="narrow-feed-butt">&lt;MY <%= ApplicationConfig["COMMUNITY_NAME"] %> FEED&gt;</button>
<% elsif timeframe_check('week') %>
<button id="narrow-feed-butt">&lt;PAST WEEK&gt;</button>
<% elsif timeframe_check('month') %>

View file

@ -2,8 +2,8 @@
<div id="footer-container" class="container <%= "centered-footer" unless current_page.include?("stories-show") %>">
<div class="inner-footer-container">
<a href="/">Home</a> <a href="/about">About</a> <a href="/privacy">Privacy Policy</a>
<a href="/terms">Terms of Use</a> <a href="/contact">Contact</a> <a href="/code-of-conduct">Code of Conduct</a>
DEV Community copyright 2016 - <%= Time.new.year %> 🔥
<a href="/terms">Terms of Use</a> <a href="/contact">Contact</a> <a href="/code-of-conduct">Code of Conduct</a> <br/>
<%= ApplicationConfig["COMMUNITY_NAME"] %> Community copyright 2016 - <%= Time.new.year %> 🔥
</div>
</div>
</footer>

View file

@ -13,7 +13,7 @@
flags: "progressive",
fetch_format: "auto",
sign_url: true), class: "sloan", alt: "sloth-mascot") %>
<h1>Join our DEV Community :)</h1>
<h1>Join our <%= ApplicationConfig["COMMUNITY_NAME"] %> Community :)</h1>
<p>
Were a place where coders share, stay up-to-date and grow their careers.
</p>

View file

@ -3,7 +3,7 @@
<div class="top-bar" id="top-bar">
<nav>
<a href="#articles-list" class="skip-content-link">Skip to content</a>
<a href="/" class="logo-link" id="logo-link" aria-label="DEV Home"><%= logo_svg %></a>
<a href="/" class="logo-link" id="logo-link" aria-label="<%= ApplicationConfig["COMMUNITY_NAME"] %> Home"><%= logo_svg %></a>
<div id="nav-search-form-root">
<div class="nav-search-form">
<form acceptCharset="UTF-8" method="get">

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<% title = yield(:title) %>
<title><%= title || "DEV Community" %></title>
<title><%= title || "#{ApplicationConfig['COMMUNITY_NAME']} Community" %></title>
<% if internal_navigation? %>
<style>
.universal-page-content-wrapper {
@ -73,7 +73,7 @@
<%= csrf_meta_tags %>
<% end %>
<link rel="manifest" href="/manifest.json" />
<link rel="search" href="https://dev.to/search.xml" type="application/opensearchdescription+xml" title="The DEV Community" />
<link rel="search" href="https://dev.to/search.xml" type="application/opensearchdescription+xml" title="The <%= ApplicationConfig["COMMUNITY_NAME"] %> Community" />
<% end %>
</head>
<body data-user-status="<%= user_logged_in_status %>" data-pusher-key="<%= ApplicationConfig["PUSHER_KEY"] %>">

View file

@ -1,21 +1,21 @@
<% title "About The Practical Dev" %>
<% title "About #{ApplicationConfig['COMMUNITY_NAME']}" %>
<%= content_for :page_meta do %>
<link rel="canonical" href="https://dev.to/about" />
<meta name="description" content="About The Practical Dev">
<meta name="description" content="About <%= ApplicationConfig["COMMUNITY_NAME"] %>">
<meta name="keywords" content="software development,engineering,rails,javascript,ruby">
<meta property="og:type" content="article" />
<meta property="og:url" content="https://dev.to/about" />
<meta property="og:title" content="About The Practical Dev" />
<meta property="og:title" content="About <%= ApplicationConfig["COMMUNITY_NAME"] %>" />
<meta property="og:image" content="http://i.imgur.com/B4JNl1w.png" />
<meta property="og:description" content="The Practical Dev is great!" />
<meta property="og:site_name" content="The Practical Dev" />
<meta property="og:description" content="<%= ApplicationConfig["COMMUNITY_NAME"] %> is great!" />
<meta property="og:site_name" content="<%= ApplicationConfig["COMMUNITY_NAME"] %>" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@ThePracticalDev">
<meta name="twitter:title" content="About The Practical Dev">
<meta name="twitter:description" content="The Practical Dev is great!">
<meta name="twitter:title" content="About <%= ApplicationConfig["COMMUNITY_NAME"] %>">
<meta name="twitter:description" content="<%= ApplicationConfig["COMMUNITY_NAME"] %> is great!">
<meta name="twitter:image:src" content="http://i.imgur.com/B4JNl1w.png">
<% end %>

View file

@ -1,4 +1,4 @@
<% title "DEV Sponsors" %>
<% title "#{ApplicationConfig['COMMUNITY_NAME']} Sponsors" %>
<%= content_for :page_meta do %>
<link rel="canonical" href="https://dev.to/sponsors" />

View file

@ -1,7 +1,10 @@
<% cache("user-profile-comments-#{@user.last_comment_at}-#{@user.id}-#{@comments.size}", expires_in: 2.day) do %>
<% cache("user-profile-comments-#{@user.last_comment_at}-#{@user.id}-#{@comments.size}", expires_in: 2.days) do %>
<style>
.index-comments header {
color: <%= HexComparer.new([user_colors(@user)[:bg], user_colors(@user)[:text]]).brightness(0.88) %>
color: <%= HexComparer.new([user_colors(@user)[:bg], user_colors(@user)[:text]]).brightness(0.88) %>;
}
.night-theme .index-comments header {
color: #cedae2;
}
</style>
<div class="index-comments">
@ -24,7 +27,7 @@
<% @comments.each do |comment| %>
<% if comment.commentable.present? && comment.commentable.published && !comment.deleted %>
<a href="<%= comment.path %>">
<div class="single-comment <%= "strong-comment" if comment.ancestry == nil %>">
<div class="single-comment <%= "strong-comment" if comment.ancestry.nil? %>">
<span class="comment-title">re: <%= comment.commentable.title %></span>
<span class="comment-date" data-published-timestamp="<%= comment.decorate.published_timestamp %>"><%= comment.readable_publish_date %></span>
<div class="comment-preview"><%= truncate(strip_tags(comment.processed_html), length: 64).html_safe %></div>

View file

@ -9,12 +9,19 @@
.widget header {
color: <%= HexComparer.new([user_colors(@user)[:bg], user_colors(@user)[:text]]).brightness(0.88) %>;
}
.night-theme .widget header {
color: #cedae2;
}
.user-profile-header .user-profile-header-container .profile-details h1{
color: <%= HexComparer.new([user_colors(@user)[:bg], user_colors(@user)[:text]]).brightness(0.78) %> !important;
}
.night-theme .user-profile-header .user-profile-header-container .profile-details h1{
color: white !important;
}
<% if user_colors(@user)[:bg].downcase.start_with?("#fff") %>
.user-profile-follow-button {
border: 1px solid <%= user_colors(@user)[:text] %> !important;
}
<% end %>
</style>
<div class="user-profile-header" style="<%= user_colors_style(@user) %>" itemscope itemtype="http://schema.org/Person" itemprop="mainEntityOfPage">
@ -24,14 +31,14 @@
<img class="profile-pic" src="<%= ProfileImage.new(@user).get(320) %>" itemprop="image" alt="<%= @user.username %> profile" style="border-color:<%= user_colors(@user)[:bg] %>;background:<%= user_colors(@user)[:bg] %>" />
</div>
<div class="profile-details">
<h1 style="color:<%= HexComparer.new([user_colors(@user)[:bg], user_colors(@user)[:text]]).brightness(0.78) %>">
<h1>
<span itemprop="name"><%= @user.name %></span>
<span class="user-profile-follow-button-wrapper">
<button id="user-follow-butt" class="cta follow-action-button user-profile-follow-button" style="color:<%= user_colors(@user)[:text] %>;background-color:<%= user_colors(@user)[:bg] %>" data-info='{"id":<%= @user.id %>,"className":"<%= @user.class.name %>"}'>&nbsp;</button>
</span>
<span class="user-profile-chat-button-wrapper">
<a href="/connect/@<%= @user.username %>" id="user-connect-redirect" style="display:none">
<button class="chat-action-button user-profile-chat-button" id="modal-opener" style="color:<%= user_colors(@user)[:text] %>;background-color:<%=user_colors(@user)[:bg] %>; display:none; ">CHAT</button>
<button class="chat-action-button user-profile-chat-button" id="modal-opener" style="color:<%= user_colors(@user)[:text] %>;background-color:<%= user_colors(@user)[:bg] %>; display:none; ">CHAT</button>
</a>
</span>
@ -43,6 +50,9 @@
.profile-details .social .icon-img path {
fill: <%= HexComparer.new([user_colors(@user)[:bg], user_colors(@user)[:text]]).brightness(0.78) %> !important;
}
.night-theme .profile-details .social .icon-img path {
fill: white;
}
</style>
<p class="social">
<% if @user.twitter_username? %>
@ -107,7 +117,7 @@
<div class="overlay"></div>
<div class="modal-content " id="new-message-modal">
<button title="Close" class="close-modal">X</button>
<form id="new-message-form" class="message-form" data-info='{"id":<%= @user.id%>,"className":"<%= @user.class.name %>","username":"<%= @user.username %>", "showChat":"<%= @user.inbox_type %>"}'>
<form id="new-message-form" class="message-form" data-info='{"id":<%= @user.id %>,"className":"<%= @user.class.name %>","username":"<%= @user.username %>", "showChat":"<%= @user.inbox_type %>"}'>
<textarea id="new-message" rows="4" cols="70" placeholder="Enter your message here..."></textarea>
<button type="submit" value="Submit" class="submit-message">SEND</button>
</form>

View file

@ -10,8 +10,8 @@ describe "User visits a homepage", type: :feature do
it "shows the sign-in block" do
within ".signin-cta-widget" do
expect(page).to have_text("SIGN IN VIA TWITTER")
expect(page).to have_text("SIGN IN VIA GITHUB")
expect(page).to have_text("Sign In With Twitter")
expect(page).to have_text("Sign In With GitHub")
end
end

View file

@ -31,7 +31,7 @@ describe "Organization index", type: :feature do
end
it "shows the proper title tag" do
expect(page).to have_title("#{organization.name} - DEV Community 👩‍💻👨‍💻")
expect(page).to have_title("#{organization.name} - #{ApplicationConfig['COMMUNITY_NAME']} Community 👩‍💻👨‍💻")
end
end

View file

@ -18,7 +18,7 @@ describe "User index", type: :feature do
end
it "shows proper title tag" do
expect(page).to have_title("#{user.name} - DEV Community 👩‍💻👨‍💻")
expect(page).to have_title("#{user.name} - #{ApplicationConfig['COMMUNITY_NAME']} Community 👩‍💻👨‍💻")
end
it "shows user's articles" do

View file

@ -37,7 +37,7 @@ RSpec.describe "Authenticating with twitter" do
user_grants_authorization_on_twitter_popup(twitter_callback_hash)
visit root_path
click_link "SIGN IN VIA TWITTER"
click_link "Sign In With Twitter"
expect(page).to have_link("Write your first post now")
expect(page).to have_link("Welcome Thread")
@ -47,7 +47,7 @@ RSpec.describe "Authenticating with twitter" do
user_do_not_grants_authorization_on_twitter_popup
visit root_path
click_link "SIGN IN VIA TWITTER"
click_link "Sign In With Twitter"
expect(page).to have_link "Sign In/Up"
expect(page).to have_link "Via Twitter"