docbrown/app/views/articles/_sticky_nav.html.erb
ludwiczakpawel 30c9175f80
Tags index design update (#9072)
* flare tag line height

* .

* dropdown fix + actions bar fix

* actions bar on mob

* .

* .

* js

* little updates

* improve contrast ratio

* Remove unused id and duplicated element id

Co-authored-by: rhymes <rhymes@hey.com>
2020-07-06 11:43:58 +02:00

91 lines
4.3 KiB
Text

<% @actor = @article.organization || @article.user %>
<div class="crayons-article-sticky grid gap-4 break-word" id="article-show-primary-sticky-nav">
<div class="crayons-card crayons-card--secondary branded-7 p-4 pt-0 hidden l:grid gap-4" style="border-top-color: <%= HexComparer.new([user_colors(@actor)[:bg], user_colors(@actor)[:text]]).brightness(0.88) %>;">
<div class="-mt-4">
<a href="<%= @actor.path %>" class="flex">
<span class="<% if @actor.class.name == "User" %>crayons-avatar crayons-avatar--xl<% elsif @actor.class.name == "Organization" %>crayons-logo crayons-logo--xl<% end %> mr-2 shrink-0">
<img src="<%= ProfileImage.new(@actor).get(width: 90) %>" class="<% if @actor.class.name == "User" %>crayons-avatar__image<% elsif @actor.class.name == "Organization" %>crayons-logo__image<% end %>" alt="<%= @actor.name %> profile image">
</span>
<span class="crayons-link fs-l fw-bold mt-5"><%= @actor.name %></span>
</a>
</div>
<% if @actor.tag_line.present? %>
<div class="color-base-70">
<%= truncate (@actor.tag_line || @actor.summary || "Posts in this tag"), length: 200 %>
</div>
<% end %>
<div>
<%= follow_button(@actor, style = "", classes = "w-100") %>&nbsp;
</div>
<% if @actor.class.name == "User" %>
<%= render "articles/user_metadata", context: "sidebar" %>
<% elsif @actor.class.name == "Organization" && @actor.approved_and_filled_out_cta? %>
<div>
<%= sanitize_rendered_markdown(@actor.cta_processed_html) %>
</div>
<% if @actor.cta_button_text.present? && @actor.cta_button_url.present? %>
<div>
<a href="<%= @actor.cta_button_url || "Learn more" %>" class="crayons-btn crayons-btn--outlined w-100">
<%= @actor.cta_button_text %>
</a>
</div>
<% end %>
<% end %>
</div>
<% cache("article-sticky-nav-articles-0-#{@article.id}-#{@actor.last_article_at}", expires_in: 48.hours) do %>
<% @sticky_collection = StickyArticleCollection.new(@article, @organization || @user) %>
<% @sticky_articles = @sticky_collection.suggested_stickies %>
<% @user_stickies = @sticky_collection.user_stickies %>
<% if @user_stickies.present? %>
<div class="crayons-card crayons-card--secondary">
<header class="crayons-card__header">
<h3 class="crayons-card__header__headline">
More from <a href="<%= @actor.path %>"><%= @actor.name %></a>
</h3>
</header>
<div>
<% @user_stickies.each_with_index do |article, index| %>
<a class="crayons-link crayons-link--contentful" href="<%= article.path %>">
<%= article.title %>
<div class="crayons-link__secondary -ml-1">
<% article.decorate.cached_tag_list_array.each do |tag| %>
<span class="crayons-tag"><span class="crayons-tag__prefix">#</span><%= tag %></span>
<% end %>
</div>
</a>
<% end %>
</div>
</div>
<% elsif @sticky_articles.present? %>
<div class="crayons-card crayons-card--secondary">
<header class="crayons-card__header">
<h3 class="crayons-card__header__headline">
Trending on <a href="<%= app_url %>"><%= community_name %></a>
<%= inline_svg_tag("twemoji/fire.svg", aria: true, class: "crayons-icon crayons-icon--default", title: "Hot") %>
</h3>
</header>
<div>
<% @sticky_articles.each_with_index do |article, index| %>
<a class="crayons-link crayons-link--contentful flex" href="<%= article.path %>">
<span class="crayons-avatar mr-2 shrink-0">
<img src="<%= ProfileImage.new(article.user).get(width: 90) %>" class="crayons-avatar__image" loading="lazy" alt="<%= article.user.name %> profile image">
</span>
<div>
<%= article.title %>
<div class="crayons-link__secondary -ml-1">
<% article.decorate.cached_tag_list_array.each do |tag| %>
<span class="crayons-tag"><span class="crayons-tag__prefix">#</span><%= tag %></span>
<% end %>
</div>
</div>
</a>
<% end %>
</div>
</div>
<% end %>
<% end %>
</div>