npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@uportal/content-carousel

v1.40.2

Published

Display portlet content in a browsable carousel

Downloads

37

Readme

Content Carousel

NPM Version Maven Central Build Status

Demo

https://uportal-project.github.io/uPortal-web-components/en/components/content-carousel/demo

Installation

# install with npm
npm install @uportal/content-carousel

# install with yarn
yarn add @uportal/content-carousel

install with maven

<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>uportal__content-carousel</artifactId>
    <version>{version number goes here}</version>
</dependency>

install with gradle

compile 'org.webjars.npm:uportal__content-carousel:{version number goes here}'

Usage as Web Component

The component requires a type. It also allows for a carousel-height (in rem units), a fit-to-container property which causes it to size to its container (horizontally), and slick-options.

<link
  href="https://unpkg.com/@uportal/content-carousel/dist/slick-theme.css"
  rel="stylesheet"
/>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/@uportal/content-carousel"></script>

<content-carousel
  type="rss"
  source="/hero.rss"
  slick-options='{ "slidesToShow": 1, "infinite": true, "arrows": true }'
  carousel-height="30rem"
  fit-to-container="true"
>
</content-carousel>

Options

  • type (required, enum[rss, portlet, passthrough]): type of data source to use.
  • source (optional, string): location or content to render in slides.
  • slick-options (optional, slick settings): configuration for slick carousel.
  • carousel-height (optional, string): css height to apply on slides.
  • fit-to-container (optional, boolean): by default carousel will fit content, true will make carousel match width of surrounding container.

Theming

Currently this component supports CSS Variables for the following abilities. Defining the following variables will change the function for the component accordingly. They will fall back to the default behavior described below.

You should define this in your custom stylesheet.

:root {
  --cc-hero-text-display: block; // Affects the grey bar at the bottom of slides.  Default is 'block'.
}

Types

There are three data source types currently supported RSS, Portlet, and Passthrough.

RSS

RSS can read any RSS feed that does not require authentication. The URL of the feed must be passed as the source attribute to the component.

<content-carousel type="rss" source="/content.rss"> </content-carousel>

Portlet

Portlet leverages the portlet registry to display slides. The URL to the registry must be passed as the source attribute to the component. The component will automatically authentice as the current user with uPortal. Specific portlet categories can be displayed by the component by changing the URL. For example /portletRegistry.json?category=Academics will display only portlets within that category.

<content-carousel type="portlet" source="/portletRegistry.json">
</content-carousel>

Passthrough

Pass through allows for arbitrary HTML to be rendered as slides. Add the HTML into the <content-carousel> and include class="slick-item" on each slide be be rendered.

<content-carousel type="passthrough">
  <div class="slick-item">arbitrary</div>
  <div class="slick-item">content</div>
  <div class="slick-item">displayed</div>
  <div class="slick-item">as</div>
  <div class="slick-item">slides</div>
</content-carousel>

Slots

The HTML content of the component can also be modified using slots.

Header

The header slot goes about the slides, and is outside the slide deck.

<content-carousel type="rss" source="/content.rss">
  <h1 slot="header">Example Header</h1>
</content-carousel>

Empty

The empty slot replaces the carousel when no content was found.

<content-carousel type="rss" source="/content.rss">
  <p slot="empty">Uh Oh, that couldn't be found.</p>
</content-carousel>

Slide

:warning: leveraging the Vue's templating language within a slide will not work until https://github.com/vuejs/vue-web-component-wrapper/issues/8 is resolved :warning:

The slide slot the rendering of individual slides to be changed. The template has access to the following data to display:

interface CarouselItem {
  id: string;
  destinationUrl?: string;
  imageUrl?: string;
  altText?: string;
  title?: string;
  description?: string;
}
<content-carousel type="rss" source="example.rss">
  <template slot="slide" slot-scope="props">
    <h1 class="slick-item">{{ props.item.title }}</h1>
  </template>
</content-carousel>

Usage as Vue component

The component source can also be imported and used directly within other Vue projects.

import contentCarousel from '@uportal/content-carousel/src/components/ContentCarousel.vue';