Add new (and first) component: DistributorTitle

- Simple wrapper around `<h3 />` for distributor title, used in the shop front
This commit is contained in:
Jean-Baptiste Bellet
2021-04-12 09:47:07 +02:00
parent 39683bd814
commit 4781d6cc84
4 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# frozen_string_literal: true
class DistributorTitleComponent < ViewComponent::Base
def initialize(name:)
@name = name
end
end

View File

@@ -0,0 +1,8 @@
require "spec_helper"
describe "DistributorTitle tests", type: :component do
it "displays distributor title with its name" do
render_inline(DistributorTitleComponent.new(name: "Freddy's Farm Shop")) { }
expect(page).to have_selector "h3", text: "Freddy's Farm Shop"
end
end

View File

@@ -0,0 +1,7 @@
class DistributorTitleComponentStories < ViewComponent::Storybook::Stories
story(:default) do
controls do
text(:name, "Freddy s Farm Shop")
end
end
end