-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hasso Plattner Institut
committed
Feb 3, 2025
1 parent
5519d6c
commit dd842f7
Showing
41 changed files
with
2,068 additions
and
1,938 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.13 |
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 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
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,81 @@ | ||
.bottom-navigation { | ||
display: flex; | ||
flex-direction: column; | ||
|
||
&__items { | ||
display: flex; | ||
width: 100%; | ||
justify-content: space-between; | ||
} | ||
|
||
&__text { | ||
color: $gray-600; | ||
} | ||
|
||
&__icon { | ||
font-size: $font-size-sm; | ||
} | ||
|
||
&__item { | ||
display: flex; | ||
|
||
max-width: 45%; | ||
align-items: center; | ||
margin: 20px 0; | ||
text-align: right; | ||
|
||
& > * { | ||
margin-right: 10px; | ||
} | ||
|
||
&:hover, | ||
&:active, | ||
&:focus { | ||
.bottom-navigation__title { | ||
color: $link-color-hover; | ||
text-decoration: underline; | ||
} | ||
} | ||
|
||
.bottom-navigation__text { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
&--prev { | ||
text-align: left; | ||
|
||
.bottom-navigation__arrow { | ||
order: 1; | ||
} | ||
|
||
.bottom-navigation__icon { | ||
order: 2; | ||
} | ||
|
||
.bottom-navigation__text { | ||
order: 3; | ||
} | ||
} | ||
|
||
&--next { | ||
// Pushes the item to the right side from a flexbox | ||
margin-left: auto; | ||
} | ||
} | ||
|
||
&__nav-text { | ||
margin: 0; | ||
color: $link-color; | ||
font-weight: bold; | ||
} | ||
|
||
&__title { | ||
display: none; | ||
|
||
@include small { | ||
display: inline; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
nav.bottom-navigation__items | ||
- items.each do |item| | ||
= link_to item[:url], class: "bottom-navigation__item #{item[:css_modifier]}", data: item[:data] | ||
.bottom-navigation__text | ||
.bottom-navigation__nav-text = item[:text] | ||
.bottom-navigation__title = item[:title] | ||
.bottom-navigation__icon | ||
= render Global::FaIcon.new(item[:icon]) | ||
.bottom-navigation__arrow | ||
= render Global::FaIcon.new(item[:arrow_icon], style: :solid) |
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,41 @@ | ||
# frozen_string_literal: true | ||
|
||
module Course | ||
class BottomNavigation < ApplicationComponent | ||
def initialize(course_id:, prev_item_id:, next_item_id:) | ||
@course_id = course_id | ||
@prev_item_id = prev_item_id | ||
@next_item_id = next_item_id | ||
end | ||
|
||
def render? | ||
@prev_item_id || @next_item_id | ||
end | ||
|
||
def items | ||
[ | ||
item_data(@prev_item_id, 'prev').presence, | ||
item_data(@next_item_id, 'next').presence, | ||
].compact | ||
end | ||
|
||
private | ||
|
||
def item_data(item_id, type) | ||
return if item_id.blank? | ||
|
||
item = Item.find(item_id) | ||
{ | ||
url: course_item_path(@course_id, item.id), | ||
title: item.title, | ||
text: t(:"items.show.#{type}_item"), | ||
icon: Item::Icon.from_resource(item).icon_class, | ||
arrow_icon: type == 'prev' ? 'chevron-left' : 'chevron-right', | ||
data: {tooltip: item.title, 'lanalytics-event': {verb: "navigated_#{type}_item"}}, | ||
css_modifier: "bottom-navigation__item--#{type}", | ||
} | ||
rescue ActiveRecord::RecordNotFound | ||
# do nothing | ||
end | ||
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,41 @@ | ||
# frozen_string_literal: true | ||
|
||
module Course | ||
class BottomNavigationPreview < ViewComponent::Preview | ||
include ActionView::Helpers::UrlHelper | ||
|
||
def default | ||
render ::Course::BottomNavigation.new(course_id: course.id, | ||
prev_item_id: item(course.items.first.id).id, | ||
next_item_id: item(course.items.third.id).id) | ||
end | ||
|
||
def next_only | ||
render ::Course::BottomNavigation.new(course_id: course.id, | ||
prev_item_id: nil, | ||
next_item_id: item(course.items.second.id).id) | ||
end | ||
|
||
def prev_only | ||
render ::Course::BottomNavigation.new(course_id: course.id, | ||
prev_item_id: item(course.items.second_to_last.id).id, | ||
next_item_id: nil) | ||
end | ||
|
||
private | ||
|
||
def course | ||
@course ||= Course.find_by(course_code: 'content-ab') | ||
end | ||
|
||
MockQuizItemPresenter = Struct.new(:id, :course_id, :section_id) | ||
|
||
def item(id) | ||
MockQuizItemPresenter.new( | ||
id:, | ||
course_id: course.id, | ||
section_id: course.sections.first.id | ||
) | ||
end | ||
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
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.