-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into layout-pcss
- Loading branch information
Showing
130 changed files
with
2,720 additions
and
1,867 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/view-components': patch | ||
--- | ||
|
||
Moving `Primer::MenuComponent` to `Primer::Alpha::Menu` and deprecating the original |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+8.49 KB
...ht/screenshots/previews.test.ts-snapshots/primer/alpha/menu_preview/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.5 KB
...ht/screenshots/previews.test.ts-snapshots/primer/alpha/menu_preview/focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+769 Bytes
...shots/previews.test.ts-snapshots/primer/beta/clipboard_copy_preview/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+676 Bytes
...shots/previews.test.ts-snapshots/primer/beta/clipboard_copy_preview/focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+481 KB
...screenshots/previews.test.ts-snapshots/primer/beta/markdown_preview/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+480 KB
...screenshots/previews.test.ts-snapshots/primer/beta/markdown_preview/focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.1 KB
...nshots/previews.test.ts-snapshots/primer/beta/relative_time_preview/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.1 KB
...nshots/previews.test.ts-snapshots/primer/beta/relative_time_preview/focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+221 Bytes
(100%)
.playwright/screenshots/previews.test.ts-snapshots/primer/local_time/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+221 Bytes
(100%)
.playwright/screenshots/previews.test.ts-snapshots/primer/local_time/focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# frozen_string_literal: true | ||
|
||
module Primer | ||
module Alpha | ||
# Use `Menu` to create vertical lists of navigational links. | ||
class Menu < Primer::Component | ||
HEADING_TAG_OPTIONS = [:h1, :h2, :h3, :h4, :h5, :h6].freeze | ||
HEADING_TAG_FALLBACK = :h2 | ||
|
||
# Optional menu heading | ||
# | ||
# @param tag [Symbol] <%= one_of(Primer::Alpha::Menu::HEADING_TAG_OPTIONS) %> | ||
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %> | ||
renders_one :heading, lambda { |tag:, **system_arguments| | ||
system_arguments[:tag] = fetch_or_fallback(HEADING_TAG_OPTIONS, tag, HEADING_TAG_FALLBACK) | ||
system_arguments[:classes] = class_names( | ||
"menu-heading", | ||
system_arguments[:classes] | ||
) | ||
|
||
Primer::BaseComponent.new(**system_arguments) | ||
} | ||
|
||
# Required list of navigational links | ||
# | ||
# @param href [String] URL to be used for the Link | ||
# @param selected [Boolean] Whether the item is the current selection | ||
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %> | ||
renders_many :items, lambda { |href:, selected: false, **system_arguments| | ||
deny_tag_argument(**system_arguments) | ||
system_arguments[:tag] = :a | ||
system_arguments[:href] = href | ||
system_arguments[:"aria-current"] = :page if selected | ||
system_arguments[:classes] = class_names( | ||
"menu-item", | ||
system_arguments[:classes] | ||
) | ||
|
||
Primer::BaseComponent.new(**system_arguments) | ||
} | ||
|
||
# @example Default | ||
# <%= render(Primer::Alpha::Menu.new) do |c| %> | ||
# <% c.with_heading(tag: :h2) do %> | ||
# Heading | ||
# <% end %> | ||
# <% c.with_item(selected: true, href: "#url") do %> | ||
# Item 1 | ||
# <% end %> | ||
# <% c.with_item(href: "#url") do %> | ||
# <%= render(Primer::OcticonComponent.new("check")) %> | ||
# With Icon | ||
# <% end %> | ||
# <% c.with_item(href: "#url") do %> | ||
# <%= render(Primer::OcticonComponent.new("check")) %> | ||
# With Icon and Counter | ||
# <%= render(Primer::Beta::Counter.new(count: 25)) %> | ||
# <% end %> | ||
# <% end %> | ||
# | ||
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %> | ||
def initialize(**system_arguments) | ||
@system_arguments = deny_tag_argument(**system_arguments) | ||
@system_arguments[:tag] = :nav | ||
@system_arguments[:classes] = class_names( | ||
"menu", | ||
@system_arguments[:classes] | ||
) | ||
end | ||
|
||
def render? | ||
items.any? | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.