forked from opf/openproject
-
Notifications
You must be signed in to change notification settings - Fork 0
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 opf#17019 from opf/feature/58512-primerised-versio…
…n-of-the-basic-work-package-hovercard [58512] Primerised version of the basic work package hovercard
- Loading branch information
Showing
9 changed files
with
80 additions
and
40 deletions.
There are no files selected for viewing
10 changes: 5 additions & 5 deletions
10
app/components/work_packages/highlighted_date_component.html.erb
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,11 +1,11 @@ | ||
<%= | ||
if @start_date == @due_date | ||
render(Primer::Beta::Text.new(**text_arguments, classes: date_classes(@start_date))) { parsed_date(@start_date) } | ||
render(Primer::Beta::Text.new(**@text_arguments, classes: date_classes(@start_date))) { parsed_date(@start_date) } | ||
else | ||
component_wrapper do | ||
concat(render(Primer::Beta::Text.new(**text_arguments)) { parsed_date(@start_date) }) | ||
concat(render(Primer::Beta::Text.new(**text_arguments)) { " - " }) if @due_date.present? | ||
concat(render(Primer::Beta::Text.new(**text_arguments, classes: date_classes(@due_date))) { parsed_date(@due_date) }) | ||
component_collection do |collection| | ||
collection.with_component(Primer::Beta::Text.new(**@text_arguments)) { parsed_date(@start_date) } | ||
collection.with_component(Primer::Beta::Text.new(**@text_arguments)) { " – " } if @due_date.present? | ||
collection.with_component(Primer::Beta::Text.new(**@text_arguments, classes: date_classes(@due_date))) { parsed_date(@due_date) } | ||
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
40 changes: 23 additions & 17 deletions
40
app/components/work_packages/hover_card_component.html.erb
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
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,15 +1,19 @@ | ||
.op-wp-hover-card | ||
display: grid | ||
align-items: center | ||
grid-template-columns: max-content max-content max-content auto 1fr | ||
grid-template-columns: auto auto auto auto 1fr | ||
grid-template-rows: max-content 1fr auto | ||
grid-row-gap: 5px | ||
grid-column-gap: 5px | ||
grid-template-areas: "status status id project project" "middleRow middleRow middleRow middleRow middleRow" "assignee assignee dates dates dates" | ||
grid-row-gap: calc(var(--stack-gap-condensed) / 2) | ||
grid-column-gap: var(--stack-gap-condensed) | ||
grid-template-areas: "type id status project project project" "subject subject subject subject subject subject" "assignee assignee assignee assignee dates dates" | ||
overflow: hidden | ||
|
||
&--middleRow | ||
align-self: flex-start | ||
&--project | ||
@include text-shortener() | ||
|
||
&--dates | ||
justify-self: flex-end | ||
white-space: nowrap | ||
|
||
&--principal | ||
max-width: 300px |
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,3 @@ | ||
<%= | ||
render(Primer::Beta::Label.new(size: :medium, inline: true, **@system_arguments)) { @status.name } | ||
%> |
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,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class WorkPackages::StatusBadgeComponent < ApplicationComponent | ||
include OpPrimer::ComponentHelpers | ||
|
||
def initialize(status:, **system_arguments) | ||
super | ||
|
||
@status = status | ||
@system_arguments = system_arguments.merge({ classes: "__hl_background_status_#{@status.id}" }) | ||
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
14 changes: 14 additions & 0 deletions
14
lookbook/previews/open_project/work_packages/status_badge_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 @@ | ||
# frozen_string_literal: true | ||
|
||
module OpenProject::WorkPackages | ||
# @logical_path OpenProject/WorkPackages | ||
class StatusBadgeComponentPreview < ViewComponent::Preview | ||
# @label Playground | ||
# @param size [Symbol] select [ medium, large] | ||
# @param inline [Boolean] | ||
def playground(size: :medium, inline: false) | ||
# Colors will be applied in code as well but there are not loaded in the lookbook | ||
render(WorkPackages::StatusBadgeComponent.new(status: Status.first, size:, inline:)) | ||
end | ||
end | ||
end |