forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from ontoportal-lirmm/feature/add-rounded-but…
…ton-component-to-lookbook Feature: Add rounded button to lookbook
- Loading branch information
Showing
8 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@import 'chips'; | ||
@import 'card_message'; | ||
@import 'chip_button'; | ||
@import 'chip_button'; | ||
@import 'rounded_button'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.rounded-button { | ||
border: 1px solid var(--primary-color); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
right: 40px; | ||
transition: background-color ease 0.3s; | ||
} | ||
|
||
.rounded-button:hover { | ||
background-color: var(--primary-color); | ||
|
||
} | ||
|
||
.rounded-button:hover svg path { | ||
fill: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class RoundedButtonComponent < ViewComponent::Base | ||
def initialize(icon: "json.svg", link: "#", size: "small") | ||
@icon = icon | ||
@link = link | ||
@size = size | ||
end | ||
|
||
def size | ||
case @size | ||
when "small" | ||
["32px", "1", "16px"] | ||
when "medium" | ||
["64px", "2", "32px"] | ||
when "big" | ||
["100px", "2.5", "50px"] | ||
end | ||
end | ||
|
||
end |
2 changes: 2 additions & 0 deletions
2
app/components/rounded_button_component/rounded_button_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
%a.rounded-button{:href => @link, style: "height:"+size[0]+"; width:"+size[0]+"; border-radius:"+size[2]+";"} | ||
= inline_svg_tag @icon, style: "transform: scale("+size[1]+");" |
14 changes: 14 additions & 0 deletions
14
test/components/previews/rounded_button_component_preview.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class RoundedButtonComponentPreview < ViewComponent::Preview | ||
|
||
# @param icon text | ||
# @param link text | ||
# @param size select [small, medium, big] | ||
|
||
def default(icon: "json.svg", link: "text", size: "small") | ||
render(RoundedButtonComponent.new(icon: icon, link: link, size: size)) | ||
end | ||
|
||
|
||
|
||
|
||
end |