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

Make the large header variant the default for PageHeaders #67

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/light-jokes-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/primer-view-components': patch
---

Make the large header variant the default for OpenProject::PageHeader
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions app/components/primer/open_project/page_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ class PageHeader < Primer::Component
HEADING_TAG_OPTIONS = [:h1, :h2, :h3, :h4, :h5, :h6].freeze
HEADING_TAG_FALLBACK = :h2

DEFAULT_HEADER_VARIANT = :medium
DEFAULT_HEADER_VARIANT = :large
HEADER_VARIANT_OPTIONS = [
:large,
:medium,
DEFAULT_HEADER_VARIANT
].freeze

DEFAULT_BACK_BUTTON_SIZE = :medium
BACK_BUTTON_SIZE_OPTIONS = [
:small,
DEFAULT_HEADER_VARIANT,
DEFAULT_BACK_BUTTON_SIZE,
:large
].freeze

Expand Down
8 changes: 4 additions & 4 deletions previews/primer/open_project/page_header_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def default
# @param with_context_bar_actions [Boolean]
# @param with_parent_link [Boolean]
def playground(
variant: :medium,
variant: :large,
title: "Hello",
description: "Last updated 5 minutes ago by XYZ.",
with_back_button: false,
Expand All @@ -49,10 +49,10 @@ def playground(
breadcrumb_items: breadcrumb_items })
end

# @label Large
def large_title
# @label Medium title
def medium_title
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title(variant: :large) { "Hello" }
header.with_title(variant: :medium) { "Hello" }
header.with_description { "Last updated 5 minutes ago by XYZ." }
end
end
Expand Down
7 changes: 4 additions & 3 deletions test/components/primer/open_project/page_header_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ def test_renders_title

assert_text("Hello")
assert_selector(".PageHeader-title")
assert_selector(".PageHeader-title--large")
end

def test_renders_large_title
render_inline(Primer::OpenProject::PageHeader.new) { |header| header.with_title(variant: :large) { "Hello" } }
def test_renders_medium_title
render_inline(Primer::OpenProject::PageHeader.new) { |header| header.with_title(variant: :medium) { "Hello" } }

assert_text("Hello")
assert_selector(".PageHeader-title")
assert_selector(".PageHeader-title--large")
assert_selector(".PageHeader-title--medium")
end

def test_renders_description
Expand Down