Skip to content

Commit

Permalink
0.0.7-beta.7 released
Browse files Browse the repository at this point in the history
- Updated README.md file with properties description
- Configurable options(NgxStoriesOptions) for the story display
- CSS fixed
  • Loading branch information
Gauravdarkslayer committed Sep 24, 2024
1 parent 131402e commit 9b76c7b
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 13 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ export class AppComponent {
<ngx-stories [storyGroups]="storyGroups"></ngx-stories>
```

## Properties
| Property | Type | Required | Description |
|--------------------|-----------------------|----------|--------------------------------------------------------------------------------------------------------------|
| `storyGroups` | `StoryGroup[]` | Yes | An input property that accepts an array of story groups. Each group contains a list of stories to display. |
| `options` | `NgxStoriesOptions` | No | Configuration options for the story display. Options include `width` and `height` to customize the dimensions. |
| `triggerOnEnd` | `EventEmitter<void>` | No | Output event that is triggered when the user reaches the end of all stories. |
| `triggerOnExit` | `EventEmitter<void>` | No | Output event that is triggered when the user manually exits the story view. |
| `triggerOnSwipeUp` | `EventEmitter<void>` | No | Output event that is triggered when the user performs a swipe-up gesture, typically for additional actions. |


## Features
* Dynamic Story Carousel: Display a collection of stories for each storyGroup.
* Easy Integration: Simple and straightforward to integrate into your Angular project.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"watch": "ng build --watch --configuration development",
"test": "ng test ngx-stories",
"test:ci": "ng test ngx-stories --watch=false --browsers=ChromeHeadless --code-coverage",
"publish": "npm run build-library && npm run postbuild-library && npm run pack-lib && cd dist/ngx-stories && npm publish --access public",
"publish": "npm run copy:readme && npm run build-library && npm run pack-lib && cd dist/ngx-stories && npm publish --access public",
"lint": "ng lint",
"lint:fix": "ng lint --fix",
"postbuild-library": "cpy README.md LICENSE projects/ngx-stories"
"copy:readme": "cpy README.md LICENSE projects/ngx-stories"
},
"private": true,
"dependencies": {
Expand Down
10 changes: 10 additions & 0 deletions projects/ngx-stories/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ export class AppComponent {
<ngx-stories [storyGroups]="storyGroups"></ngx-stories>
```

## Properties
| Property | Type | Required | Description |
|--------------------|-----------------------|----------|--------------------------------------------------------------------------------------------------------------|
| `storyGroups` | `StoryGroup[]` | Yes | An input property that accepts an array of story groups. Each group contains a list of stories to display. |
| `options` | `NgxStoriesOptions` | No | Configuration options for the story display. Options include `width` and `height` to customize the dimensions. |
| `triggerOnEnd` | `EventEmitter<void>` | No | Output event that is triggered when the user reaches the end of all stories. |
| `triggerOnExit` | `EventEmitter<void>` | No | Output event that is triggered when the user manually exits the story view. |
| `triggerOnSwipeUp` | `EventEmitter<void>` | No | Output event that is triggered when the user performs a swipe-up gesture, typically for additional actions. |


## Features
* Dynamic Story Carousel: Display a collection of stories for each storyGroup.
* Easy Integration: Simple and straightforward to integrate into your Angular project.
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-stories/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-stories",
"version": "0.0.7-beta.5",
"version": "0.0.7-beta.7",
"peerDependencies": {
"@angular/common": "^18.2.0",
"@angular/core": "^18.2.0",
Expand Down
5 changes: 5 additions & 0 deletions projects/ngx-stories/src/lib/interfaces/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ export interface StoryGroup {
name: string, // name of the storyGroup which is to be displayed over story
stories: Story[] // array of stories
}

export interface NgxStoriesOptions {
width: number,
height: number,
}
18 changes: 10 additions & 8 deletions projects/ngx-stories/src/lib/ngx-stories.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
position: relative;
overflow: hidden;
border-radius: 10px;

opacity: 0;
display: none;

position: relative;
width: 100%;
height: 100%;
transition: transform 0.6s ease-in-out;
max-width: 100%;
max-height: 100%;
margin: auto;
}

.story-container.active {
opacity: 1;
display: block;
width: 360px;
margin-left: auto;
margin-right: auto;
}
Expand All @@ -42,7 +40,7 @@
background-color: rgba(128, 128, 128, 0.705);
border-radius: 5px;
overflow: hidden;

}

.progress-bar::-webkit-progress-bar {
Expand Down Expand Up @@ -125,7 +123,7 @@ button:nth-child(1) {
.next {
opacity: 0;
top: 50%;
max-height: 80vh;
max-height: 80%;
}

.story-content-container {
Expand All @@ -135,6 +133,7 @@ button:nth-child(1) {
justify-content: space-between;
align-items: center;
z-index: 1;

button {
display: none;
}
Expand All @@ -146,6 +145,7 @@ button:nth-child(1) {
align-items: center;
justify-content: center;
position: absolute;

img {
max-width: 100%;
max-height: 100%;
Expand All @@ -159,13 +159,15 @@ button:nth-child(1) {
position: relative;
display: flex;
height: fit-content;

.pause-icon {
content: url('data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ5SURBVHgBpVXLceJAEB3JfC4cRBXfmzIwjsByBMtGAI5gyQApgrUjgI1g2QiACIwjEK6iCopPwZnvvgctSmYlIbxdNZoezXS/7p6ebk1FkOu6RiaT+QHW0jTNPBwOpmytMAYYf7bbbadcLg/DdGhBP8fjsZlIJFpUrGIQgNu73c4JAvoHYDabNTA1MQyfgr5YPJC1CY/o1aNPdEWQUqn0EgqwWCya+/3ePm5o2gqKXuHJSzabXakAWi6XJkJUF4M8svP5vKOCLMc4cMznc5fCKibxLGU8+clk0vjkgcT8DawBy4d3d3dPsHqobiCCIERdSYQVPHvgnejc1HXdVhLzrygnUYay6pRhhiSJ0mk9AGpcIP5OkHKcsUajUSUOCKZXWVrwytCBVPUOpFKpdpAgzvxMp9Nv0+m0RYNUBDEpPH69XjcYom9cMBUjQpPlB/dThwJeZlOFe8EQ9cgjMo8EqAhAT8UnG964GPWgTeh6l9kkgCHWDdUNxNKB0UJ6/g7YHnhndPWfhMTIRu0T4EP4q1niJ3oM5d8LhYJ1uecvigRwReA+pmJeooOcfyg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XrgiawoQojMWBnzfw+ii3zaDpYRG0+l0EQ+EwaS8wfYK+Rraaf0iAIn+Q/FzoBR2lV9Swk2/jYCXVNVYCRAEwsuyYcDGM74L/Jvo83Y4gMtnLl+ikr4B8QGOWkmYr9YAAAAASUVORK5CYII=');
}

}
}
}
7 changes: 7 additions & 0 deletions projects/ngx-stories/src/lib/ngx-stories.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { StoryGroup } from '../lib/interfaces/interfaces';
import "hammerjs";
import { CommonModule } from '@angular/common';
import { NgxStoriesService } from './ngx-stories.service';
import { NgxStoriesOptions } from '../lib/interfaces/interfaces';

@Component({
selector: 'ngx-stories',
Expand All @@ -19,6 +20,11 @@ export class NgxStoriesComponent implements AfterViewInit {
// Input property to accept the list of storyGroup and their stories
@Input({ required: true }) storyGroups: StoryGroup[] = [];

// options
@Input() options: NgxStoriesOptions = {
width: 360,
height: 768,
};
// Output events to handle end of stories, exit, and swipe-up gesture
@Output() triggerOnEnd = new EventEmitter<void>();
@Output() triggerOnExit = new EventEmitter<void>();
Expand Down Expand Up @@ -73,6 +79,7 @@ export class NgxStoriesComponent implements AfterViewInit {
hammer.on('swipedown', () => this.handleSwipe('down'));
hammer.on('swipeup', () => this.handleSwipe('up'));
});
this.storyService.setOptions(this.options, this.storyContainers);
}

handleSwipe(direction: string) {
Expand Down
14 changes: 12 additions & 2 deletions projects/ngx-stories/src/lib/ngx-stories.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from "@angular/core";
import { StoryGroup } from "./interfaces/interfaces";
import { ElementRef, Injectable, QueryList } from "@angular/core";
import { NgxStoriesOptions, StoryGroup } from "./interfaces/interfaces";
@Injectable({
providedIn: 'root',
})
Expand Down Expand Up @@ -45,4 +45,14 @@ export class NgxStoriesService {
}
return { storyGroupIndex: currentStoryGroupIndex, storyIndex: currentStoryIndex };
}

setOptions(options: NgxStoriesOptions, storyContainers: QueryList<ElementRef>): void {
// Set the options for the service
// Set the width and height of the story container
storyContainers?.forEach(storyContainer => {
storyContainer.nativeElement.style.width = options.width + 'px';
storyContainer.nativeElement.style.height = options.height + 'px';
});

}
}

0 comments on commit 9b76c7b

Please sign in to comment.