Skip to content

Commit

Permalink
Fixed some bugs and the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
xSentry committed Aug 25, 2024
1 parent e812c7b commit a6250df
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ Use the component in your template:
## API

```html
<om-scrollbar [styleClass]="'your-custom-class'">
<om-scrollbar [styleClass]="'your-custom-class'" [onlyShowOnHover]="onlyShowOnHover">
<ng-content></ng-content>
</om-scrollbar>
```

- styleClass (optional): A custom CSS class to apply to the scrollbar component for additional styling.
- `styleClass` (optional): A custom CSS class to apply to the scrollbar component for additional styling.
- `onlyShowOnHover` (optional): Sets if the scrollbar is only visible while you hover the content.

## Example

Expand Down Expand Up @@ -125,20 +126,17 @@ om-scrollbar {


/* Global styling */
.custom-scrollbar.om-scrollbar-bar {
background-color: #ff6347; /* Tomato color for the scrollbar */
width: 0.75rem;
border-radius: 12px;
opacity: 0.7;
transition: opacity 0.2s;
}

.custom-scrollbar .om-scrollbar-bar:hover {
opacity: 1; /* While hovering */
}

.custom-scrollbar .om-scrollbar.om-scrollbar-bar-active {
opacity 1; /* While dragging */
.custom-scrollbar {
background-color: rgb(60, 60, 60) !important;
width: 0.5rem !important;
border-radius: 12px !important;
transition: background-color 0.2s;

&:hover,
&.om-scrollbar-bar-active {
background-color: rgb(80, 80, 80) !important;
opacity: 1 !important;
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@omnedia/ngx-scrollbar",
"description": "A simple component library to create a custom scrollbar for the Y-Direction. ",
"version": "1.0.0",
"version": "1.0.1",
"peerDependencies": {
"@angular/common": "^18.2.0",
"@angular/core": "^18.2.0"
Expand Down
6 changes: 3 additions & 3 deletions src/lib/ngx-scrollbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
background-color: grey;
right: -1.5rem;
border-radius: 10px;
transition: opacity 0.2;
transition: opacity 0.2s;

&:hover,
&.om-scrollbar-bar-active {
opacity: 0.9;
opacity: 0.8;
}
}

&:hover > .sidebar-scrollbar {
&:hover > .om-scrollbar-bar {
display: block;
}

Expand Down
5 changes: 5 additions & 0 deletions src/lib/ngx-scrollbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export class NgxScrollbarComponent implements AfterViewInit {
@Input('styleClass')
styleClass?: string;

@Input('onlyShowOnHover')
set onlyShowOnHover(onlyShowOnHover: boolean) {
this.style['--om-scrollbar-hover-display'] = onlyShowOnHover ? 'none' : 'block';
}

style: any = {};

private scrollPercent = 0;
Expand Down

0 comments on commit a6250df

Please sign in to comment.