Skip to content

Commit

Permalink
Make the large header variant the default for PageHeaders
Browse files Browse the repository at this point in the history
  • Loading branch information
HDinger committed Jan 8, 2024
1 parent 905f8c8 commit a465b9e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
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
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

0 comments on commit a465b9e

Please sign in to comment.