<nav role="navigation" aria-label="Pages" class="bux-pagination">

    <ul class="bux-pagination__list">

        <li class="bux-pagination__item">
            <a class="bux-pagination__link bux-pagination__link--previous" href="#" aria-label="Go to previous page"></a>
        </li>

        <li class="bux-pagination__item">
            <a class="bux-pagination__link" href="[object Object]" aria-label="Page 1">1</a>
        </li>
        <li class="bux-pagination__item">
            <a class="bux-pagination__link" href="[object Object]" aria-label="Page 2">2</a>
        </li>
        <li class="bux-pagination__item">
            <a class="bux-pagination__link" href="[object Object]" aria-label="Page 3">3</a>
        </li>
        <li class="bux-pagination__item">
            <a class="bux-pagination__link bux-pagination__link--current" href="[object Object]" aria-label="Current page, page 4" aria-current="true">4</a>
        </li>
        <li class="bux-pagination__item">
            <a class="bux-pagination__link" href="[object Object]" aria-label="Page 5">5</a>
        </li>

        <li class="bux-pagination__item">
            <span class="bux-pagination__link bux-pagination__link--truncated" aria-hidden="true" role="presentation"></span>
        </li>

        <li class="bux-pagination__item">
            <a class="bux-pagination__link bux-pagination__link--next" href="#" aria-label="Go to next page"></a>
        </li>
    </ul>
</nav>
{# 

Pagination

Available variables:

- modifier:         Sets the pagination variant. Can be null, alt or reverse
- current_page:     Integer for the current page, starting at 1.
- previous_page:    URL of the previous page.
- next_page:        URL of the next page.
- total_pages:      Integer value of the total number of pages, starting at 1.
- pages:            Array containing the URLs of all pages.
- truncate_start:   Boolean. Set to true to truncate pagination at start.
- truncate_end:     Boolean. Set to true to truncate pagination at end.
- truncate_pages:   Array containing a list of pages to truncate.
- zero_based_index: Boolean. Set to true if your system is using zero based
                    indexing.

#}

{% set base = 0 %}

{% if zero_based_index %}{% set base = 1 %}{% endif %}

<nav role="navigation" aria-label="Pages"
     class="bux-pagination{% if modifier %} bux-pagination--{{ modifier }}{% endif %}">

	<ul class="bux-pagination__list">

		{# Display previous link if we"re not on the first page. #}
		{% if previous_page %}
			<li class="bux-pagination__item">
				<a class="bux-pagination__link bux-pagination__link--previous"
           href="{{ previous_page }}" aria-label="Go to previous page"></a>
			</li>
		{% endif %}

		{# Display elipsis if truncate_start. #}
		{% if truncate_start == true %}
			<li class="bux-pagination__item">
				<span class="bux-pagination__link bux-pagination__link--truncated" aria-hidden="true" role="presentation"></span>
			</li>
		{% endif %}

        {% for key, page in pages %}
            <li class="bux-pagination__item">
            {% if current_page == key %}
              <a class="bux-pagination__link bux-pagination__link--current"
                 href="{{ page }}" aria-label="Current page, page {{ key + base }}" aria-current="true">
                {{- key + base -}}
              </a>
            {% else %}
              <a class="bux-pagination__link"
                 href="{{ page }}" aria-label="Page {{ key + base }}">
                {{- key + base -}}
              </a>
            {% endif %}
            </li>
        {% endfor %}

		{# Display elipsis if truncate_end. #}
		{% if truncate_end == true %}
			<li class="bux-pagination__item">
				<span class="bux-pagination__link bux-pagination__link--truncated" aria-hidden="true" role="presentation"></span>
			</li>
		{% endif %}

		{# Display next link if we"re not on the last page. #}
		{% if next_page %}
			<li class="bux-pagination__item">
				<a class="bux-pagination__link bux-pagination__link--next"
           href="{{ next_page }}" aria-label="Go to next page"></a>
			</li>
		{% endif %}
	</ul>
</nav>
site_name_prefix: Office of
site_name: Learning Relations Excellence
site_slogan: Additional text or site slogan
address_1: 100 Building Name
address_2: 1 Oval Mall
city: Columbus
state: OH
zip: '43210'
contact_email: email@osu.edu
contact_phone: 614-292-OHIO
contact_tty: 614-688-8605
current_page: 3
previous_page: '#'
next_page: '#'
zero_based_index: true
total_pages: 9
pages:
  - '1': '#'
  - '2': '#'
  - '3': '#'
  - '4': '#'
  - '5': '#'
truncate_end: true
truncate_pages:
  - 5
  - 6
  - 7
  - 8
  • Content:
    @mixin pagination($link-color: $scarlet, $active-bg: $gray-light-80) {
    	font-family: $sans;
    	margin-top: 4px;
    
    	.bux-pagination__list {
    		list-style: none;
    		display: flex;
    		justify-content: center;
    		align-items: center;
    	}
    
    	.bux-pagination__item {
    
    	}
    
    	.bux-pagination__link {
    		display: table-cell;
    		vertical-align: middle;
    		font-size: $ts-base;
    		font-weight: 600;
    		color: $link-color;
    		text-decoration: none;
    		height: 40px;
    		width: 40px;
    		padding: $sp-8;
    		text-align: center;
    
    		&:hover {
    			background-color: $active-bg;
    			color: $gray-dark-80;
    		}
    		&:focus {
    			position: relative;
    			outline: 2px solid $focus;
    		}
    	}
    
    	.bux-pagination__link--truncated {
    		&:hover {
    			background-color: $clear;
    			color: $link-color;
    		}
    	}
    
    	.bux-pagination__link--previous:before,
    	.bux-pagination__link--next:after {
    		font-family: $icon;
    		font-size: $ts-20;
    		line-height:0;
    		vertical-align: rem-calc(-5);
    	}
    
    	.bux-pagination__link--previous:before {
    		content: "\f004";
    		font-weight: 400;
    	}
    
    	.bux-pagination__link--next:after {
    		content: "\f005";
    		font-weight: 400;
    	}
    
    	.bux-pagination__link--truncated:before {
    		font-family: $icon;
    		content: "\f00d";
    		font-size: $ts-xs;
    		color: $gray-dark-80;
    	}
    
    	.bux-pagination__link--current {
    		background-color: $active-bg;
    		color: $gray-dark-80;
    		cursor: default;
    		border-bottom: $sp-4 $scarlet solid;
    		padding-bottom: $sp-4;
    	}
    }
    
    .bux-pagination {
    	@include pagination();
    }
    
    .bux-pagination--alt {
    	@include pagination($scarlet, $white);
    }
    
    .bux-pagination--reverse {
    	@include pagination($white, $white);
    }
    
  • URL: /components/raw/pagination/_pagination.scss
  • Filesystem Path: src/components/pagination/_pagination.scss
  • Size: 1.6 KB

No notes defined.