Skip to content

Commit ff8716a

Browse files
authored
Merge pull request #4 from joni7777/main
Add support for custom width
2 parents d7d2534 + a65adfa commit ff8716a

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ public function cards(NovaRequest $request)
119119
}
120120
```
121121

122+
### Custom width (small, medium or large)
123+
124+
```php
125+
public function cards(NovaRequest $request)
126+
{
127+
return [
128+
FieldProgressbar::make('Awesomeness')
129+
->options([
130+
'width' => 'medium',
131+
]),
132+
];
133+
}
134+
```
135+
122136
Feel free to come with suggestions for improvements.
123137

124138
Packages based on this package: [nova-progressbar-field](https://github.com/signifly/nova-progressbar-field) by [Signifly](https://github.com/signifly)

dist/js/field.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"/js/field.js": "/js/field.js"
3-
}
3+
}

resources/js/components/IndexField.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
<template>
2+
<div class="w-full" :class="padding">
23
<span class="pg-bar" ref="chartContainer"></span>
4+
</div>
35
</template>
46

57
<script>
68
const ProgressBar = require('progressbar.js');
9+
const widthSizes = {
10+
large: '',
11+
medium: 'px-6',
12+
small: 'px-10'
13+
}
714
815
export default {
916
props: ['resourceName', 'field'],
@@ -19,6 +26,7 @@
1926
sub: null,
2027
animateColor: false,
2128
},
29+
padding: ''
2230
};
2331
},
2432
mounted: function () {
@@ -36,6 +44,7 @@
3644
this.drawLine();
3745
break;
3846
}
47+
this.padding = widthSizes[this.options.width] ?? widthSizes.full;
3948
},
4049
methods: {
4150
drawLine() {

0 commit comments

Comments
 (0)