GithubHelp home page GithubHelp logo

nejdetkadir / phlex-heroicons Goto Github PK

View Code? Open in Web Editor NEW
21.0 1.0 3.0 166 KB

Heroicons extension for Phlex

License: MIT License

Ruby 99.97% Shell 0.03%
heroicons phlex ruby view-component phlex-heroicons extension rails-views view

phlex-heroicons's Introduction

Gem Version test rubocop Ruby Style Guide Ruby Version

Phlex::Heroicons

Heroicons extension for Phlex. Includes all icons along with solid and outline variants found in Heroicons.

Installation

Add this line to your application's Gemfile:

gem 'phlex-heroicons'

Install the gem and add to the application's Gemfile by executing:

$ bundle add phlex-heroicons

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install phlex-heroicons

Configuration

Phlex::Heroicons.configure do |config|
  config.default_class = 'h-6 w-6'
  config.default_variant = :solid
end

Phlex::Heroicons.configuration.default_class = 'h-4 w-4'
Phlex::Heroicons.configuration.default_variant = :outline

Usage

class Hello < Phlex::HTML
  def initialize(name:)
    @name = name
  end

  def view_template
    div do
      render Phlex::Heroicons::HandRaised.new(variant: :solid, classes: 'h-4 w-4')
      h1 { "Hello #{@name}!" }
    end
  end
end 

Also

<%= render Phlex::Heroicons::HandRaised.new(variant: :solid, classes: 'h-4 w-4') %>
<h1>Hello <%= current_user.name %></h1>

Icons

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nejdetkadir/phlex-heroicons. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Phlex::Heroicons project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

phlex-heroicons's People

Contributors

macklinu avatar mhenrixon avatar nejdetkadir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

phlex-heroicons's Issues

uninitialized constant Phlex::View (NameError)

Hi Nejdet!

Firstly, thanks so much for creating this! It's exactly what I'm looking for.

I just tried to install the gem on a rails app using phlex-rails gem and got this issue. I'm not sure how to solve it and was wondering if I could get some help ๐Ÿ™

I've included the error below and also the relevant code I have added. Let me know if you need more info.

Error:

phlex-components-library git:(phlex-heroicons) โœ— rails s
/Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/phlex-heroicons-1.0.0/lib/phlex/heroicons/base.rb:6:in `<module:Heroicons>': uninitialized constant Phlex::View (NameError)

    class Base < Phlex::View
                      ^^^^^^
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/phlex-heroicons-1.0.0/lib/phlex/heroicons/base.rb:5:in `<module:Phlex>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/phlex-heroicons-1.0.0/lib/phlex/heroicons/base.rb:4:in `<main>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/phlex-heroicons-1.0.0/lib/phlex/heroicons.rb:10:in `require_relative'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/phlex-heroicons-1.0.0/lib/phlex/heroicons.rb:10:in `<module:Heroicons>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/phlex-heroicons-1.0.0/lib/phlex/heroicons.rb:9:in `<module:Phlex>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/phlex-heroicons-1.0.0/lib/phlex/heroicons.rb:8:in `<main>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:73:in `rescue in block in require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:51:in `block in require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:44:in `each'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:44:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler.rb:187:in `require'
	from /Users/georgekettle/code/georgekettle/phlex-components-library/config/application.rb:7:in `<main>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands/server/server_command.rb:137:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands/server/server_command.rb:134:in `perform'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:`in` `dispatch'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/command/base.rb:87:in `perform'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/command.rb:48:in `invoke'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<main>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from ./bin/rails:4:in `<main>'
/Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require': cannot load such file -- phlex-heroicons (LoadError)
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:55:in `each'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:55:in `block in require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:44:in `each'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/runtime.rb:44:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler.rb:187:in `require'
	from /Users/georgekettle/code/georgekettle/phlex-components-library/config/application.rb:7:in `<main>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands/server/server_command.rb:137:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands/server/server_command.rb:134:in `perform'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/command/base.rb:87:in `perform'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/command.rb:48:in `invoke'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<main>'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/georgekettle/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from ./bin/rails:4:in `<main>'

config/initializers/phlex_heroicons.rb

Phlex::Heroicons.configure do |config|
  config.default_class = 'h-4 w-4'
  config.default_variant = :solid
end

Gemfile

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.1.2"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.8"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
gem "jsbundling-rails"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"

# Bundle and process CSS [https://github.com/rails/cssbundling-rails]
gem "cssbundling-rails"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

# Use Redis adapter to run Action Cable in production
gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Use Sass to process CSS
# gem "sassc-rails"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

group :development, :test do
  # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
  gem "debug", platforms: %i[ mri mingw x64_mingw ]
end

group :development do
  # Use console on exceptions pages [https://github.com/rails/web-console]
  gem "web-console"

  # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
  # gem "rack-mini-profiler"

  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"
end

group :test do
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
  gem "capybara"
  gem "selenium-webdriver"

end

gem "phlex-rails"
gem 'phlex-heroicons'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.