samedi 4 février 2023

bulma html does not display as expect even though the code is entered properly

I am newbie with Rails and here is my problem

I created a rails program by this command

rails new freelancer -d=postgresql --javascript=webpack

And I had no problem

I wanted to use bulma extension in my rails program and I added these line to the gemfile

gem 'bulma-rails', '~> 0.9.4'
gem 'bulma-extensions-rails', '~> 1.0.30'

and these lines to the app -> assets -> stylesheets -> application.css

@import 'bulma';
@import 'bulma-extensions';

then I ran these commands

bundle install;
yarn add jquery;

and I had no error.

I created a rails page by this command

rails g controller pages home

and add the bulma code to the app -> views -> layouts -> application.html.erb file

Here is my application.html.erb file

<!DOCTYPE html>
<html>
<head>
<title>Freelancer</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
</head>
<body>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://bulma.io">
  <img src="https://bulma.io/images/bulma-logo.png" width="112" height="28">
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
  <span aria-hidden="true"></span>
  <span aria-hidden="true"></span>
  <span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
  <a class="navbar-item">
    Home
  </a>
  <a class="navbar-item">
    Documentation
  </a>
  <div class="navbar-item has-dropdown is-hoverable">
    <a class="navbar-link">
      More
    </a>
    <div class="navbar-dropdown">
      <a class="navbar-item">
        About
      </a>
      <a class="navbar-item">
        Jobs
      </a>
      <a class="navbar-item">
        Contact
      </a>
      <hr class="navbar-divider">
      <a class="navbar-item">
        Report an issue
      </a>
    </div>
  </div>
</div>
<div class="navbar-end">
  <div class="navbar-item">
    <div class="buttons">
      <a class="button is-primary">
        <strong>Sign up</strong>
      </a>
      <a class="button is-light">
        Log in
      </a>
    </div>
  </div>
</div>
</div>
</nav>
<%= yield %>
</body>
</html>

I thought that my home page must be the design as here

https://bulma.io/documentation/components/navbar/

, but it liked this

my problem

I did not know why it became like this ? Could you please give me some advice for my problem ? Here is my code, if you need for reference

https://github.com/nguyencuc2586/freelancer01

Thank you in advance!

Aucun commentaire:

Enregistrer un commentaire