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 #288 from ontoportal-lirmm/feature/add-upload-onto…
…logy-components-to-lookbook Feature: Add form inputs components to lookbook
- Loading branch information
Showing
35 changed files
with
302 additions
and
105 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.file_uploader { | ||
color: #D7D7EF; | ||
font-family: 'Lato', sans-serif; | ||
border: 1px dashed #CFCFCF; | ||
border-radius: 5px; | ||
} | ||
|
||
.file-message { | ||
display: flex; | ||
margin-top: 10px; | ||
font-size: 12px; | ||
color: #888888; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.file_uploader>h2 { | ||
margin: 50px 0; | ||
} | ||
|
||
.file-drop-area { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
padding: 25px; | ||
transition: 0.2s; | ||
position: relative; | ||
} | ||
|
||
.choose-file-button { | ||
flex-shrink: 0; | ||
background-color: rgba(255, 255, 255, 0.04); | ||
border: 1px solid rgba(255, 255, 255, 0.1); | ||
border-radius: 3px; | ||
padding: 8px 15px; | ||
margin-right: 10px; | ||
font-size: 12px; | ||
text-transform: uppercase; | ||
} | ||
|
||
.file-input { | ||
height: 100%; | ||
width: 100%; | ||
cursor: pointer; | ||
opacity: 0; | ||
position: absolute; | ||
} | ||
|
||
.file-drop-area svg path { | ||
fill: #CECECE; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.input-field-component{ | ||
width: 100%; | ||
font-size: 13px; | ||
padding: 10px; | ||
border: 1px solid #BDBDBD; | ||
border-radius: 5px; | ||
outline: none; | ||
resize: none; | ||
} | ||
|
||
.input-field-component:focus{ | ||
border: 1px solid var(--primary-color); | ||
} | ||
|
||
.text-input-label{ | ||
font-size: 12px; | ||
color: #666666; | ||
margin-bottom: 5px; | ||
} | ||
|
||
.text-input-error-text{ | ||
font-size: 12px; | ||
color: var(--error-color) | ||
} | ||
|
||
.text-input-helper-text{ | ||
font-size: 12px; | ||
color: #666666; | ||
margin-top: 5px; | ||
} |
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,14 +1,14 @@ | ||
.text-content{ | ||
overflow: hidden; | ||
display: -webkit-box; | ||
-webkit-box-orient: vertical; | ||
-webkit-line-clamp: var(--read-more-line-clamp, 5); | ||
.text-content { | ||
overflow: hidden; | ||
display: -webkit-box; | ||
-webkit-box-orient: vertical; | ||
-webkit-line-clamp: var(--read-more-line-clamp, 5); | ||
} | ||
|
||
|
||
.see_more_text { | ||
color: var(--primary-color); | ||
font-size: 15px; | ||
margin-top: 10px; | ||
text-align: end; | ||
color: var(--primary-color); | ||
font-size: 15px; | ||
margin-top: 10px; | ||
text-align: end; | ||
} |
This file was deleted.
Oops, something went wrong.
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
5 changes: 0 additions & 5 deletions
5
app/components/file_input_loader_component/file_input_loader_component.html.haml
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class Form::DateComponent < InputFieldComponent | ||
def initialize(label: '', name:, value: Date.today, placeholder: '', error_message: '', helper_text: '') | ||
super(label: label, name: name, value: value, placeholder: placeholder, error_message: error_message, helper_text: helper_text) | ||
end | ||
end |
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 @@ | ||
= render InputFieldComponent.new(label: @label, name: @name, value: @value, placeholder: @placeholder, error_message: @error_message, helper_text: @helper_text, type: 'date') |
2 changes: 1 addition & 1 deletion
2
...components/file_input_loader_component.rb → app/components/form/file_input_component.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
5 changes: 5 additions & 0 deletions
5
app/components/form/file_input_component/file_input_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,5 @@ | ||
.file_uploader{data: {controller: "file-input"}} | ||
.file-drop-area.w-100 | ||
= inline_svg_tag "upload-file.svg" | ||
%span.file-message{data:{'file-input': {target: 'message'}}} Drop your file here or, browse files on your device. | ||
= file_field_tag @name, class: 'file-input', data:{'file-input-target': 'input', action: 'file-input#updateMessage'} |
File renamed without changes.
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,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class Form::SelectComponent < InputFieldComponent | ||
|
||
def initialize(id: nil, label: '', name:, value: [], selected: '', placeholder: '', error_message: '', helper_text: '', multiple: false, open_to_add_values: false) | ||
super(label: label, name: name, value: value, placeholder: placeholder, error_message: error_message, helper_text: helper_text) | ||
@values = value | ||
@selected = selected | ||
@open_to_add_values = open_to_add_values | ||
@multiple = multiple | ||
@id = id | ||
end | ||
end |
2 changes: 2 additions & 0 deletions
2
app/components/form/select_component/select_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 @@ | ||
= render InputFieldComponent.new(name: @name, error_message: @error_message, helper_text: @helper_text) do | ||
= render SelectInputComponent.new(id: @id, name: @name, values: @values , selected: @selected , multiple: @multiple, open_to_add_values: @open_to_add_values ) |
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,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class Form::TextAreaComponent < InputFieldComponent | ||
def initialize(label: '', name:, value: nil, placeholder: '', error_message: '', helper_text: '', rows: "5") | ||
super(label: label, name: name, value: value, placeholder: placeholder, error_message: error_message, helper_text: helper_text) | ||
@rows = rows | ||
end | ||
end |
2 changes: 2 additions & 0 deletions
2
app/components/form/text_area_component/text_area_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 @@ | ||
= render InputFieldComponent.new(label: @label, name: @name, value: @value, placeholder: @placeholder, error_message: @error_message, helper_text: @helper_text) do | ||
%textarea.input-field-component{name: @name, rows: @rows, placeholder: @placeholder, style: error_style, value: @value} |
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,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class Form::TextInputComponent < InputFieldComponent | ||
def initialize(label: '', name:, value: nil, placeholder: '', error_message: '', helper_text: '') | ||
super(label: label, name: name, value: value, placeholder: placeholder, error_message: error_message, helper_text: helper_text) | ||
end | ||
end |
1 change: 1 addition & 0 deletions
1
app/components/form/text_input_component/text_input_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 @@ | ||
= render InputFieldComponent.new(label: @label, name: @name, value: @value, placeholder: @placeholder, error_message: @error_message, helper_text: @helper_text, type: 'text') |
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,30 @@ | ||
class InputFieldComponent < ViewComponent::Base | ||
def initialize(label: "" , name:, value: 'Syphax', type: 'text', placeholder: "", error_message: "", helper_text: "") | ||
@label = label | ||
@name = name | ||
@placeholder = placeholder | ||
@error_message = error_message | ||
@helper_text = helper_text | ||
@value = value | ||
@type = type | ||
end | ||
|
||
|
||
def error_style | ||
"border-color: var(--error-color);" if error? | ||
end | ||
|
||
def error? | ||
!@error_message.empty? | ||
end | ||
|
||
def help? | ||
!@helper_text.empty? | ||
end | ||
|
||
def label? | ||
!@label.empty? | ||
end | ||
end | ||
|
||
|
28 changes: 28 additions & 0 deletions
28
app/components/input_field_component/input_field_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,28 @@ | ||
%div | ||
- if label? | ||
.text-input-label | ||
= @label | ||
|
||
- if content | ||
= content | ||
- else | ||
%input.input-field-component.text-input{name: @name, type: @type, placeholder: @placeholder, style: error_style, value: @value} | ||
|
||
|
||
|
||
- if error? | ||
.text-input-error-text | ||
= @error_message | ||
- if help? | ||
.text-input-helper-text | ||
= @helper_text | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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
2 changes: 1 addition & 1 deletion
2
app/components/select_input_component/select_input_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
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
Oops, something went wrong.