Skip to content

Commit

Permalink
refactor: an attempt to refactor media-item css
Browse files Browse the repository at this point in the history
  • Loading branch information
machikoyasuda committed Dec 6, 2024
1 parent 27eea85 commit edfa4cf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 35 deletions.
10 changes: 5 additions & 5 deletions benefits/core/templates/core/includes/media-item.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<li class="media d-flex align-items-stretch w-auto">
<li class="media">
<div class="media-body">
{% block heading_wrapper %}
<{{ heading_tag|default:"h3" }} class="media-body--heading h3">
{% block heading %}
{% endblock heading %}
</{{ heading_tag|default:"h3" }}>
<h2 class="h3">
{% block heading %}
{% endblock heading %}
</h2>
{% endblock heading_wrapper %}
{% block body %}
{% endblock body %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
{% endblock heading %}

{% block body %}
<div class="media-body--details">
<div>
<p>
{% translate "You will be able to create an account using your email address if you do not already have one. We use your Login.gov account to verify your identity." %}
{% translate "Learn more about identity verification" as text %}
{% include "core/includes/modal-trigger.html" with modal="modal--identity-verification" text=text period=True %}
</p>
<div class="media-body--items">
<div>
<p>{% translate "For this process you will need:" %}</p>
<ul>
<ul class="ms-lg-5 ms-0">
<li>{% translate "Your state-issued ID card" %}</li>
<li>{% translate "Your Social Security number" %}</li>
<li>{% translate "A phone number with a phone plan associated with your name" %}</li>
Expand Down
2 changes: 1 addition & 1 deletion benefits/eligibility/templates/eligibility/start.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% block inner-content %}
<div class="col-lg-6">
<p class="py-4">{% translate "You will need a few items to continue:" %}</p>
<ul class="media-list mx-0 px-0 d-flex justify-content-center flex-column">
<ul class="d-flex flex-column gap-4 list-unstyled ps-0 pb-5 mb-3">
{% block media-item %}
{% endblock media-item %}
{% include "eligibility/includes/media-item--contactless-card--start.html" %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{% extends "core/includes/media-item.html" %}
{% load i18n %}

{% block heading_wrapper %}
{% with heading_tag="h2" %}{{ block.super }}{% endwith %}
{% endblock heading_wrapper %}

{% block heading %}
{% translate "The next step is to enroll the contactless card you will use to tap to ride for a reduced fare." %}
{% endblock heading %}
Expand Down
2 changes: 1 addition & 1 deletion benefits/enrollment/templates/enrollment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="pb-lg-8 pb-4">
{% block inner-content %}
{% block media-items %}
<div class="col-12 col-sm-12 col-lg-8">
<ul class="media-list mx-0 px-0 d-flex justify-content-center flex-column">
<ul class="d-flex list-unstyled ps-0 pb-5 mb-3">
{% include "enrollment/includes/media-item--contactless-card--index.html" %}
</ul>
</div>
Expand Down
25 changes: 4 additions & 21 deletions benefits/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ li {
font-family: var(--bs-body-font-family);
}

ul li {
list-style-type: disc;
}

/* Paragraph: Body Text */
/* Same sizes for all screen widths */
p,
Expand Down Expand Up @@ -600,43 +604,22 @@ footer .footer-links li a.footer-link:visited {

:root {
--media-item-icon-size: calc(64rem / 16);
--media-item-gap: calc(24rem / 16);
--media-item-icon-margin: calc(24rem / 16);
}

@media (min-width: 992px) {
:root {
--media-item-icon-size: calc(90rem / 16);
--media-item-gap: calc(24rem / 16);
--media-item-icon-margin: calc(32rem / 16);
}
}

.media-body--details p:not(:first-of-type) {
/* All the p within .media-body--details, except for the first p - Any media item with more than one p */
padding-top: calc(24rem / 16);
}

.media-list {
gap: var(--media-item-gap);
margin-bottom: calc(64rem / 16);
}

.media-list-icon-left-margin {
margin-left: calc(
var(--media-item-icon-size) + var(--media-item-icon-margin)
);
}

.media-list .media .media-body--details,
.media-list .media .media-body--items li:first-child {
padding-top: calc(5rem / 16);
}

.media-list .media .media-body--items li {
list-style-type: disc;
}

/* Cards */

:root {
Expand Down

0 comments on commit edfa4cf

Please sign in to comment.