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 YARD & docs for CounterComponent #64

Merged
merged 1 commit into from Sep 4, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -216,6 +216,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.25)
zeitwerk (2.4.0)

PLATFORMS
Expand All @@ -239,6 +240,7 @@ DEPENDENCIES
spring-watcher-listen (~> 2.0.0)
view_component_storybook (~> 0.4.0)
webpacker (~> 5.0)
yard (~> 0.9.25)

BUNDLED WITH
1.17.3
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -163,6 +163,10 @@ Remember that restarting the Rails server is necessary to see changes, as the ge
To minimize the number of restarts, we recommend checking the component in Storybook first, and then when it's in a good state,
you can check it in your app.

### Documentation

Document components with [YARD](https://yardoc.org/). Docs are published to [RubyDoc.info](https://rubydoc.info/github/primer/view_components).

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
7 changes: 7 additions & 0 deletions app/components/primer/counter_component.rb
Expand Up @@ -9,6 +9,13 @@ class CounterComponent < Primer::Component
:light_gray => "Counter Counter--gray-light",
}.freeze

# @param count [Integer, Float::INFINITY, nil] The number to be displayed (e.x. # of issues, pull requests)
# @param scheme [Symbol] Color scheme. One of `SCHEME_MAPPINGS.keys`.
# @param limit [Integer] Maximum value to display. (e.x. if count == 6,000 and limit == 5000, counter will display "5,000+")
# @param hide_if_zero [Boolean] If true, a `hidden` attribute is added to the counter if `count` is zero.
# @param text [String] Text to display instead of count.
# @param round [Boolean] Whether to apply our standard rounding logic to value.
# @param kwargs [Hash] Style arguments to be passed to Primer::Classify
def initialize(
count: 0,
scheme: DEFAULT_SCHEME,
Expand Down
1 change: 1 addition & 0 deletions primer_view_components.gemspec
Expand Up @@ -36,4 +36,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rubocop-github", "~> 0.13.0"
spec.add_development_dependency "simplecov", "~> 0.18.0"
spec.add_development_dependency "simplecov-console", "~> 0.7.2"
spec.add_development_dependency "yard", "~> 0.9.25"
end