Skip to content

Commit

Permalink
component generator: correcting template and thor tasks to account fo…
Browse files Browse the repository at this point in the history
…r component status (#1229)

* ensuring the component template has the correct status and status module

* correcting component_generator insertion into nav.yml file

* Create good-needles-fix.md

Co-authored-by: Jon Rohan <[email protected]>
  • Loading branch information
mxriverlynn and jonrohan authored Jul 27, 2022
1 parent bbdcc17 commit 5631d28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-needles-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

component generator: correcting template and thor tasks to account for component status
4 changes: 2 additions & 2 deletions component_generator.thor
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ComponentGenerator < Thor::Group
insert_into_file(
"docs/src/@primer/gatsby-theme-doctocat/nav.yml",
component_nav,
after: "url: \"/components\"\n children:\n"
after: "- title: Components\n children:\n"
)
end

Expand All @@ -78,7 +78,7 @@ class ComponentGenerator < Thor::Group
def component_nav
<<-HEREDOC
- title: #{class_name} - Fix my order in docs/src/@primer/gatsby-theme-doctocat/nav.yml
url: /components/#{status_path}#{short_name}
url: "/components/#{status_path}#{short_name}"
HEREDOC
end

Expand Down
4 changes: 2 additions & 2 deletions templates/component.tt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module Primer
# Add additional usage considerations or best practices that may aid the user to use the component correctly.
# @accessibility Add any accessibility considerations
class <%= class_name %> < Primer::Component
status :alpha
status :<%= status %>

# @example Example goes here
#
# <%%= render(Primer::<%= class_name %>.new) { "Example" } %>
# <%%= render(Primer::<%= status_module %><%= class_name %>.new) { "Example" } %>
#
# @param system_arguments [Hash] <%%= link_to_system_arguments_docs %>
def initialize(**system_arguments)
Expand Down

0 comments on commit 5631d28

Please sign in to comment.