iastate / frontend-component-library
Frontend component library for Iowa State University.
Installs: 382
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 7
Forks: 1
Open Issues: 1
Language:JavaScript
- dev-master
- 1.0.78
- 1.0.77
- 1.0.76
- 1.0.75
- 1.0.74
- 1.0.73
- 1.0.72
- 1.0.71
- 1.0.70
- 1.0.69
- 1.0.68
- 1.0.67
- 1.0.66
- 1.0.65
- 1.0.64
- 1.0.63
- 1.0.62
- 1.0.61
- 1.0.60.2
- 1.0.60.1
- 1.0.60
- 1.0.59.3
- 1.0.59.2
- 1.0.59.1
- 1.0.59
- 1.0.58.1
- 1.0.58
- 1.0.57.95
- 1.0.57.9
- 1.0.57.8
- 1.0.57.7
- 1.0.57.6
- 1.0.57.5
- 1.0.57.4
- 1.0.57.3
- 1.0.57.2
- 1.0.57.1
- 1.0.57
- 1.0.56.6
- 1.0.56.5
- 1.0.56.4
- 1.0.56.3
- 1.0.56.2
- 1.0.56.1
- 1.0.56
- 1.0.55
- 1.0.54
- 1.0.53
- 1.0.52
- 1.0.51
- 1.0.50
- 1.0.49.3
- 1.0.49.2
- 1.0.49.1
- 1.0.49
- 1.0.48
- 1.0.47
- 1.0.46
- 1.0.45
- 1.0.44
- 1.0.43
- 1.0.42
- 1.0.41
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.34
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.1
- 1.0.0
- dev-develop
- dev-captions
- dev-bigfix/feature-with-image-link-color
- dev-nimbus-sans-replacement
- dev-image-gallery-set
- dev-calendar_dev
- dev-bugfix/accordion-test
This package is auto-updated.
Last update: 2024-11-07 22:00:57 UTC
README
This is a frontent library designed and built for use in Iowa State University web projects.
- Staging site: staging2.idfive.com, currently displaying the master branch. Use
guest/guest
for username/password. - Repo: Bitbucket private.
- Build pipelines: Buddy, idfive access only.
Installation of this library into your projects
Installing via composer
Whenever possible, we reccomend using composer to install this library, to ensure all future updates can be pulled in to your project.
composer require iastate/frontend-component-library
Using the library
In general, to use this library in your own project, you would need to link the CSS/JS files from the build folder:
- Link to
/build/css/index.css
- Link to
/build/css/print.css
(print syles only) - Link to
/build/js/index.js
You can then pull, and utilize the provided markup examples in your own project.
Development
This library is designed to be used "as-is" for most developers. If you wish to modify this library, you will need to create your own fork. This section is strictly information for those working on, and committing to, this project.
The component library includes Fractal for component based development. Your own components can be added to the src/components
folder. Static assets such as JavaScript, CSS and images will be served out of the build
folder, but can also be configured to your specific needs by editing the fractal.js file. For more information, read the fractal guide.
General notes:
- Installed Boostrap 5.1, the site uses the default breakpoints
- Using Iowa State color variables
- Using Iowa State Font Awesome for social media icons and various elements
- All CSS/JS is scoped to not interfere with Boostrap, using a prefix of "iastate22-" on relevant classes
- All components live in the
src/components
directory - The page structure can be found in
src/components/_page-preview.twig
. For individual components, the structure is located insrc/components/_preview.twig
Dependencies
Dependencies need to be installed with node/npm, and is best pinned to stable versions via nvm. More on node usage at idfive.
cd idfive-component-library
nvm use
npm install
Building for development
To start the fractal development server:
cd idfive-component-library
nvm use
npm run fractal
Building for production
To build your code for production, prior to a release, run the following:
npm run build
npm run fractal:build
This will generate build
and fractal
folders at the root of your project. The build
folder contains all of your compiled assets (CSS, JavaScript etc.), while the fractal
folder contains a static generated version of your Fractal component library, which can be used for previews and an online reference to your component library. The build
folder is committed, in order that projects may use it as a dependency directly.
Versioning
Releases for this project should follow Semantic Versioning.
Steps when releasing:
- Commit (or merge) and push master to origin.
- Tag
1.0.1
(the new release version), and push to origin. The tag is what composer uses to define a new release.
Markup
- Written using Twig templates
- Proper ARIA functionality is used to meet WCAG accessibility guidelines
Page wrapper and overall structure
This structure below shows the overall wrappers and ordering needed to properly display the layout:
<body> <a class="skip-link" href="#main-content">Skip To Main Content</a> <div class="off-canvas"> <div class="max-bound"> {% include "@site-header" with header %} <main id="main-content"> {{ yield }} </main> {% include "@site-footer" with footer %} </div> </div> <!-- Scripts Here --> </body>
- The
.skip-link
link is provided for accessibility purposes - The
.off-canvas
div is in use to setoverflow-x: hidden;
on the whole page to prevent unwanted horizontal scrolling - Next is the
.max-bound
div, which provides a max-width, (and 100% width), centers the content and provides a background-color the the whole document - Next our main site header is added
{% include "@site-header" with header %}
- Then the
<main id="main-content">
is added which contains all of the page content{{ yield }}
- After the closing
<main>
tag, the footer is added{% include "@site-footer" with footer %}
- Kitchen sink pages have an additional tag
<div class="outer-pad">
directly after<main>
, which provides left and right padding for the page
Images
All images should be added to src/images
which compiles to build/images/*
.
CSS/JS
- All CSS/JS/Images will be compiled from
src/*
. - All CSS to be written as SCSS, and compiled via Webpack.
- All CSS compiled from
src/scss/index.scss
- All theme JS is written as TypeScript, and compiled to stable, browser-compliant JS via Webpack.
- ALL JS to be compiled from Typescript in
src/js/index.ts
Utility Classes
- In
_base.scss
,.align-left
,.align-right
, and.align-center
handle images placed in WYSIWYG sections - In
_base.scss
, the.skip-link
class is for the "Skip To Main Content" button for accessibility - In
_placeholder-selectors.scss
,.visible-for-screen-readers
is used to hide content but allow it to be accessibly read/spoken - In
_placeholder-selectors.scss
,.outer-pad-x
handles horiztonal padding throughout various parts of the site - In
_placeholder-selectors.scss
,%responsive-img
is a placeholder selector which sets up object-fit for images and the padding-top percentage for the associated pseudo element which sets the height of the image - In
_placeholder-selectors.scss
,.caption
is a re-used type style for image and video captions - In
_placeholder-selectors.scss
,.arrow
is the arrow shape used throughout various button and nav styles - In
_base.scss
, there are two helper classes for remove the space above and below paragraph widgets..paragraph-widget-no-margin-bottom
will reduce themargin-bottom
of the widget to zero and.paragraph-widget-no-margin-top
will reduce themargin-top
top zero. These both have!important
tags attached to ensure there are no conflicts.
Acceptance Standards
- W3C Validation
- Passes Accessibility check using WAVE and Google Lighthouse
- Provides fallback of full content for non-JS users.