Skip to content

Commit

Permalink
Issue 1945: Implemented changes for Blockquote component as per new r…
Browse files Browse the repository at this point in the history
…equirementss (#1964)

Blockquote implementation as per new requirements alongwith  Angular, React support and documentation update
  • Loading branch information
bhushan-ebi committed Oct 2, 2023
1 parent 9b33ded commit 22f0780
Show file tree
Hide file tree
Showing 21 changed files with 769 additions and 27 deletions.
8 changes: 8 additions & 0 deletions components/vf-blockquote/CHANGELOG.md
@@ -1,3 +1,11 @@
### 1.2.1

* Changed: Modified the Blockquote component in line with stakeholder requirements and to improve consistency
* Added : Angular support for Blockquote component
* Added : React support for Blockquote component
* Documentation: Updated the documentation for blockquote as per new implementation
* [Tracking issue](https://github.com/visual-framework/vf-core/issues/1945)

### 1.2.0

* adds context `if` statement to make it useable in vf-11ty.
Expand Down
123 changes: 121 additions & 2 deletions components/vf-blockquote/README.md
Expand Up @@ -4,11 +4,130 @@

## About

A way to quote and highlight text.
The `vf-blockquote` highlights a section that is quoted from an external source.

## Usage

The pullquote variant will be a decorative variation but has yet to be implemented, it may take inspiration from the [VF 1.3 pullquote](https://www.ebi.ac.uk/style-lab/websites/patterns/pullquotes.html).
The `vf-blockquote` should be used to highlight texts from external sources like quotes and testimonials. It should be used for more than decorative purposes, ensuring that the text being quoted is relevant to the content of the page and adds value to the content. This component is not optimised for mobile devices.

It should not be confused with a pull quote which highlights a section of text from the same source/page.

Quotes should be as concise as possible. The impact of the blockquote is diminished when it has long texts as this overwhelms the reader.

Provide proper attribution such as the name, source and relevant information to give credibility to the quote. The component allows you to add the image of the person, the name (Which can be linked to a profile or source page) and other attribution details.

The blockquote is designed to be used on a white background, it is advisable to avoid using it on backgrounds with gradients, images or other colours. If the background colour is changed, ensure the contrast ratio between the texts and the background meet accessibility standards.


### When to use

- Quoting external sources such as individuals, experts, publications etc.
- Testimonials and feedback can be highlighted using the `vf-blockquote`.

### When not to use

- Self-quoting or usage as a pull quote should be avoided in the context of the page/content. This component should not be used to highlight a portion of text from the same content.
- `Vf-blockquotes` should not be used solely for decorative purposes, ensuring that the quoted text adds value to the content.

### Accessibility

- This component targets WCAG 2.1 AA accessibility.

### Angular

As of version 1.2.1 vf-blockquote has experimental Angular support.
This package was generated with Angular version 15.2.0 and has been tested on application with Angular version 15.2.0.

1. install `yarn add @visual-framework/vf-blockquote`
2. import in your app.module
```
import { VfBlockquoteAngularModule } from '@visual-framework/vf-blockquote/vf-blockquote.angular';
@NgModule({
imports: [VfBlockquoteAngularModule, YourOtherModules],
...
})
```
3. can be used as
```
<vf-blockquote [blockquote_text]="'“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.”'" [blockquote_author]="'Marion Burton'" [blockquote_author_imageurl]="'./assets/vf-icon--avatar.svg'" [blockquote_author_href]="'#'" [blockquote_author_details]="'Title and other details'"/>
```
4. add to your styles.scss
```
@import '../node_modules/@visual-framework/vf-sass-config/index.scss';
@import '../node_modules/@visual-framework/vf-sass-config/mixins/vf-utility-mixins.scss';
@import '../node_modules/@visual-framework/vf-utility-classes/vf-utility-classes.scss';
@import '../node_modules/@visual-framework/vf-sass-utilities/vf-sass-utilities.scss';
@import '../node_modules/@visual-framework/vf-blockquote/vf-blockquote.scss';
@font-face {
font-family: 'IBM Plex Sans';
font-style: normal;
font-weight: 500;
src: local('IBM Plex Sans Medium'),
local('IBMPlexSans-Medium'),
url('../node_modules/@visual-framework/vf-font-plex-sans/assets/IBM-Plex-Sans/fonts/complete/woff/IBMPlexSans-Medium.woff') format('woff'),
url('../node_modules/@visual-framework/vf-font-plex-sans/assets/IBM-Plex-Sans/fonts/complete/woff2/IBMPlexSans-Medium.woff2') format('woff2');
}
```

5. Usage:

```
<vf-blockquote [blockquote_text]="'“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.”'"
[blockquote_author]="'Marion Burton'"
[blockquote_author_imageurl]="'./assets/vf-icon--avatar.svg'"
[blockquote_author_href]="'#'"
[blockquote_author_details]="'Title and other details'"/>
```

### React

As of version 1.2.1 vf-blockquote has experimental React support which has been tested on react version 18.2.0

1. install `yarn add @visual-framework/vf-blockquote`
2. import in the JS file where you want to include this component
```
import VfBlockquote from '@visual-framework/vf-blockquote/vf-blockquote.react';
Make sure you have the jsx support enabled with babel. Alternatively, you can also copy the vf-blockquote.react.js file from below to your react project and import as per the location.
```
3. can be used as
```
<VfBlockquote blockquote_text='“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.”'
blockquote_author='Marion Burton'
blockquote_author_imageurl='vf-icon--avatar.svg'
blockquote_author_href='#'
blockquote_author_details='Title and other details'/>
```
4. add below to your SCSS file
```
@import '@visual-framework/vf-sass-config/index.scss';
@import '@visual-framework/vf-sass-config/mixins/vf-utility-mixins.scss';
@import '@visual-framework/vf-utility-classes/vf-utility-classes.scss';
@import '@visual-framework/vf-sass-utilities/vf-sass-utilities.scss';
@import '@visual-framework/vf-blockquote/vf-blockquote.scss';
@font-face {
font-family: 'IBM Plex Sans';
font-style: normal;
font-weight: 500;
src: local('IBM Plex Sans Medium'),
local('IBMPlexSans-Medium'),
url('../node_modules/@visual-framework/vf-font-plex-sans/assets/IBM-Plex-Sans/fonts/complete/woff/IBMPlexSans-Medium.woff') format('woff'),
url('../node_modules/@visual-framework/vf-font-plex-sans/assets/IBM-Plex-Sans/fonts/complete/woff2/IBMPlexSans-Medium.woff2') format('woff2');
}
```

5. Usage:

```
<VfBlockquote blockquote_text='“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.”'
blockquote_author='Marion Burton'
blockquote_author_imageurl='vf-icon--avatar.svg'
blockquote_author_href='#'
blockquote_author_details='Title and other details'/>
```

## Install

Expand Down
24 changes: 24 additions & 0 deletions components/vf-blockquote/vf-blockquote.angular/README.md
@@ -0,0 +1,24 @@
# VfBlockquoteAngular

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.0.

## Code scaffolding

Run `ng generate component component-name --project vf-blockquote.angular` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project vf-blockquote.angular`.
> Note: Don't forget to add `--project vf-blockquote.angular` or else it will be added to the default project in your `angular.json` file.
## Build

Run `ng build vf-blockquote.angular` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build vf-blockquote.angular`, go to the dist folder `cd dist/vf-blockquote.angular` and run `npm publish`.

## Running unit tests

Run `ng test vf-blockquote.angular` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,92 @@
import { Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
export class VfBlockquoteAngularComponent {
constructor() {
this.html = '';
this.text = '';
this.blockquote_text = '';
this.blockquote_author = '';
this.blockquote_author_href = '';
this.blockquote_author_details = '';
this.blockquote_author_imageurl = '';
this.override_class = '';
this.class = '';
this.quote = '';
}
ngOnInit() {
//Initialize something
}
ngOnChanges() {
this.setValues();
}
/* Set values as per input and updated changes */
setValues() {
/* Conditional styles, strings, nullables, arrays of styles */
this.class = 'vf-blockquote';
this.class += this.override_class ? this.override_class : '';
/* Inner content of the quote based on whether HTML or Text */
this.quote = this.blockquote_text
? this.blockquote_text
: this.html
? this.html
: this.text;
}
}
VfBlockquoteAngularComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VfBlockquoteAngularComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
VfBlockquoteAngularComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: VfBlockquoteAngularComponent, selector: "vf-blockquote", inputs: { id: "id", html: "html", text: "text", blockquote_text: "blockquote_text", blockquote_author: "blockquote_author", blockquote_author_href: "blockquote_author_href", blockquote_author_details: "blockquote_author_details", blockquote_author_imageurl: "blockquote_author_imageurl", override_class: "override_class" }, usesOnChanges: true, ngImport: i0, template: `
<blockquote [attr.id]="id !== undefined ? id : null" [class]="class">
<div class="vf-blockquote-flex-container">
<div *ngIf="blockquote_author_imageurl !== ''" class="vf-blockquote_author__image">
<img [src]="blockquote_author_imageurl" alt="" loading="lazy" />
</div>
<div>
<div>{{ quote }}</div>
<footer>
<a *ngIf="blockquote_author_href !== ''; else quoteauthorplain" class="vf-blockquote_author__link" [href]="blockquote_author_href" [innerHTML]="blockquote_author"></a>
<ng-template #quoteauthorplain>{{ blockquote_author }}</ng-template>
<div *ngIf="blockquote_author_details !== ''" class="vf-blockquote_author_details">{{ blockquote_author_details }}</div>
</footer>
</div>
</div>
</blockquote>
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VfBlockquoteAngularComponent, decorators: [{
type: Component,
args: [{ selector: 'vf-blockquote', template: `
<blockquote [attr.id]="id !== undefined ? id : null" [class]="class">
<div class="vf-blockquote-flex-container">
<div *ngIf="blockquote_author_imageurl !== ''" class="vf-blockquote_author__image">
<img [src]="blockquote_author_imageurl" alt="" loading="lazy" />
</div>
<div>
<div>{{ quote }}</div>
<footer>
<a *ngIf="blockquote_author_href !== ''; else quoteauthorplain" class="vf-blockquote_author__link" [href]="blockquote_author_href" [innerHTML]="blockquote_author"></a>
<ng-template #quoteauthorplain>{{ blockquote_author }}</ng-template>
<div *ngIf="blockquote_author_details !== ''" class="vf-blockquote_author_details">{{ blockquote_author_details }}</div>
</footer>
</div>
</div>
</blockquote>
` }]
}], propDecorators: { id: [{
type: Input
}], html: [{
type: Input
}], text: [{
type: Input
}], blockquote_text: [{
type: Input
}], blockquote_author: [{
type: Input
}], blockquote_author_href: [{
type: Input
}], blockquote_author_details: [{
type: Input
}], blockquote_author_imageurl: [{
type: Input
}], override_class: [{
type: Input
}] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmYtYmxvY2txdW90ZS5hbmd1bGFyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL3ZmLWJsb2NrcXVvdGUuYW5ndWxhci9zcmMvbGliL3ZmLWJsb2NrcXVvdGUuYW5ndWxhci5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQVUsTUFBTSxlQUFlLENBQUM7OztBQXVCekQsTUFBTSxPQUFPLDRCQUE0QjtJQXJCekM7UUF3QlcsU0FBSSxHQUFHLEVBQUUsQ0FBQztRQUNWLFNBQUksR0FBRyxFQUFFLENBQUM7UUFDVixvQkFBZSxHQUFHLEVBQUUsQ0FBQztRQUNyQixzQkFBaUIsR0FBRyxFQUFFLENBQUM7UUFDdkIsMkJBQXNCLEdBQUcsRUFBRSxDQUFDO1FBQzVCLDhCQUF5QixHQUFHLEVBQUUsQ0FBQztRQUMvQiwrQkFBMEIsR0FBRyxFQUFFLENBQUM7UUFDaEMsbUJBQWMsR0FBRyxFQUFFLENBQUM7UUFFN0IsVUFBSyxHQUFHLEVBQUUsQ0FBQztRQUNYLFVBQUssR0FBRyxFQUFFLENBQUM7S0F1Qlo7SUFyQkMsUUFBUTtRQUNOLHVCQUF1QjtJQUN6QixDQUFDO0lBRUQsV0FBVztRQUNULElBQUksQ0FBQyxTQUFTLEVBQUUsQ0FBQztJQUNuQixDQUF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