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

Add beta layouts #937

Closed
wants to merge 118 commits into from
Closed

Add beta layouts #937

wants to merge 118 commits into from

Conversation

jklina
Copy link
Contributor

@jklina jklina commented Dec 7, 2021

This adds the beta SplitPageLayout and PageLayout components which will replace the existing alpha Layout component.

This cannot be deployed until the corresponding CSS is first deployed: primer/css#1737 and primer/css#1849

@vercel
Copy link

vercel bot commented Dec 7, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/view-components/BcDPZiX9caxvgMWYUnvx2RL9DtMy
✅ Preview: https://view-components-git-add-beta-layouts-primer.vercel.app

@jklina jklina mentioned this pull request Dec 7, 2021
@vercel vercel bot temporarily deployed to Preview December 7, 2021 21:05 Inactive
@vercel vercel bot temporarily deployed to Preview December 8, 2021 13:55 Inactive
@vercel vercel bot temporarily deployed to Preview December 8, 2021 14:06 Inactive
@vercel vercel bot temporarily deployed to Preview December 8, 2021 14:30 Inactive
@vercel vercel bot temporarily deployed to Preview December 8, 2021 14:33 Inactive
@vercel vercel bot temporarily deployed to Preview December 8, 2021 14:43 Inactive
@vercel vercel bot temporarily deployed to Preview December 8, 2021 15:13 Inactive
@vercel vercel bot temporarily deployed to Preview December 22, 2021 20:24 Inactive
@vercel vercel bot temporarily deployed to Preview December 23, 2021 14:56 Inactive
@vercel vercel bot temporarily deployed to Preview December 23, 2021 15:00 Inactive
@vercel vercel bot temporarily deployed to Preview December 23, 2021 15:02 Inactive
@vercel vercel bot temporarily deployed to Preview December 23, 2021 15:33 Inactive
@vercel vercel bot temporarily deployed to Preview December 23, 2021 15:40 Inactive
Sync with upstream Primer / CSS changes
@vercel vercel bot temporarily deployed to Preview December 23, 2021 17:25 Inactive
@vercel vercel bot temporarily deployed to Preview December 23, 2021 17:28 Inactive
@vercel vercel bot temporarily deployed to Preview January 19, 2022 22:06 Inactive
@vercel vercel bot temporarily deployed to Preview January 21, 2022 13:08 Inactive
@vercel vercel bot temporarily deployed to Preview January 21, 2022 13:10 Inactive
@vercel vercel bot temporarily deployed to Preview January 21, 2022 13:12 Inactive
Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few suggestions to align the PageLayout ViewComponent API to the proposed React API. Think of these comments as conversation starters, not strong opinions 😄

Comment on lines +22 to +29
WRAPPER_SIZING_DEFAULT = :fluid
WRAPPER_SIZING_MAPPINGS = {
WRAPPER_SIZING_DEFAULT => "",
:md => "container-md",
:lg => "container-lg",
:xl => "container-xl"
}.freeze
WRAPPER_SIZING_OPTIONS = WRAPPER_SIZING_MAPPINGS.keys.freeze
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WRAPPER_SIZING_DEFAULT = :fluid
WRAPPER_SIZING_MAPPINGS = {
WRAPPER_SIZING_DEFAULT => "",
:md => "container-md",
:lg => "container-lg",
:xl => "container-xl"
}.freeze
WRAPPER_SIZING_OPTIONS = WRAPPER_SIZING_MAPPINGS.keys.freeze
CONTAINER_WIDTH_DEFAULT = :full
CONTAINER_WIDTH_MAPPINGS = {
WRAPPER_SIZING_DEFAULT => "",
:medium => "container-md",
:large => "container-lg",
:xlarge => "container-xl"
}.freeze
CONTAINER_WIDTH_OPTIONS = CONTAINER_WIDTH_MAPPINGS.keys.freeze

# @param primary_region [Symbol] When `responsive_variant` is set to `:separate_regions`, defines which region appears first on small viewports. `:content` is default.
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
def initialize(
wrapper_sizing: WRAPPER_SIZING_DEFAULT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wrapper_sizing: WRAPPER_SIZING_DEFAULT,
container_width: CONTAINER_WIDTH_DEFAULT,

class Content < Primer::Component
status :beta

WIDTH_DEFAULT = :fluid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WIDTH_DEFAULT = :fluid
WIDTH_DEFAULT = :full

status :beta

WIDTH_DEFAULT = :fluid
WIDTH_OPTIONS = [WIDTH_DEFAULT, :md, :lg, :xl].freeze
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WIDTH_OPTIONS = [WIDTH_DEFAULT, :md, :lg, :xl].freeze
WIDTH_OPTIONS = [WIDTH_DEFAULT, :medium, :large, :xlarge].freeze


def call
render(Primer::BaseComponent.new(**@system_arguments)) do
if @width == :fluid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if @width == :fluid
if @width == :full

# <% c.footer_region(divider: true, border: true) { "Header" } %>
# <% end %>
#
# @param wrapper_sizing [Symbol] Define the maximum width of the component. `:fluid` sets it to full-width. Other values center Layout horizontally. <%= one_of(Primer::Beta::PageLayout::WRAPPER_SIZING_OPTIONS) %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# @param wrapper_sizing [Symbol] Define the maximum width of the component. `:fluid` sets it to full-width. Other values center Layout horizontally. <%= one_of(Primer::Beta::PageLayout::WRAPPER_SIZING_OPTIONS) %>
# @param container_size [Symbol] Define the maximum width of the page container. `:full` sets it to full-width. Other values center Layout horizontally. <%= one_of(Primer::Beta::PageLayout::CONTAINER_WIDTH_OPTIONS) %>

# @param width [Symbol] <%= one_of(Primer::Beta::PageLayout::Content::WIDTH_OPTIONS) %>
# @param tag [Symbol] <%= one_of(Primer::Beta::PageLayout::Content::TAG_OPTIONS) %>
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
renders_one :content_region, "Primer::Beta::PageLayout::Content"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
renders_one :content_region, "Primer::Beta::PageLayout::Content"
renders_one :content, "Primer::Beta::PageLayout::Content"

# @param divider [Boolean] Whether to show a header divider
# @param divider_narrow [Symbol] Whether to show a divider below the `header` region if in responsive mode. <%= one_of(Primer::Beta::PageLayout::HEADER_DIVIDER_NARROW_OPTIONS) %>
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
renders_one :header_region, lambda { |divider: false, divider_narrow: :line, **header_system_arguments|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
renders_one :header_region, lambda { |divider: false, divider_narrow: :line, **header_system_arguments|
renders_one :header, lambda { |divider: false, divider_narrow: :line, **header_system_arguments|

# @param divider [Boolean] Whether to show a footer divider
# @param divider_narrow [Symbol] Whether to show a divider below the `footer` region if in responsive mode. <%= one_of(Primer::Beta::PageLayout::FOOTER_DIVIDER_NARROW_OPTIONS) %>
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
renders_one :footer_region, lambda { |divider: false, divider_narrow: FOOTER_DIVIDER_NARROW_DEFAULT, **footer_system_arguments|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
renders_one :footer_region, lambda { |divider: false, divider_narrow: FOOTER_DIVIDER_NARROW_DEFAULT, **footer_system_arguments|
renders_one :footer, lambda { |divider: false, divider_narrow: FOOTER_DIVIDER_NARROW_DEFAULT, **footer_system_arguments|

# @param position_narrow [Symbol] Pane placement when `Layout` is in column modes. <%= one_of(Primer::Beta::PageLayout::Pane::POSITION_NARROW_OPTIONS) %>
# @param divider [Boolean] Whether to show a pane line divider.
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
renders_one :pane_region, lambda { |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
renders_one :pane_region, lambda { |
renders_one :pane, lambda { |

@github-actions
Copy link
Contributor

Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days.

@github-actions github-actions bot added the Stale Automatically marked as stale. label May 24, 2022
@jonrohan jonrohan closed this May 26, 2022
@jonrohan jonrohan deleted the add-beta-layouts branch August 17, 2022 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Automatically marked as stale.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants