Skip to content

Commit

Permalink
Merge pull request #6 from boite-beet/feature/size-options
Browse files Browse the repository at this point in the history
Add size options for detail and index views
  • Loading branch information
Kristories authored Dec 13, 2020
2 parents 5eb4e2b + f65ef95 commit 34b50c1
Show file tree
Hide file tree
Showing 9 changed files with 15,071 additions and 10 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ Qrcode::make('QR Code')

![Basic](https://i.imgur.com/V15fjwl.png)

#### Setting sizes

```php
Qrcode::make('QR Code')
->text('http://laravel.com')
->indexSize(100)
->detailSize(500)
```


#### With logo

```php
Expand Down
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"/js/field.js": "/js/field.js",
"/css/field.css": "/css/field.css"
"/js/field.js": "/js/field.js"
}
15,042 changes: 15,042 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions resources/js/components/DetailField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<vue-qr
class="qr-item"
:text="this.field.text"
size="200"
:size="this.field.detailSize"
:bgSrc="this.field.background"
:logoSrc="this.field.logo"
margin="0"
:margin="0"
></vue-qr>
</p>
</panel-item>
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/IndexField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<vue-qr
class="qr-item"
:text="this.field.text"
size="50"
:size="this.field.indexSize"
:bgSrc="this.field.background"
:logoSrc="this.field.logo"
margin="0"
:margin="0"
></vue-qr>
</span>
</template>
Expand Down
1 change: 0 additions & 1 deletion resources/sass/field.scss

This file was deleted.

14 changes: 13 additions & 1 deletion src/Qrcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class Qrcode extends Field

public function __construct()
{
$this->exceptOnForms();
$this->exceptOnForms()
->indexSize(50)
->detailSize(200);
}

public function text($text = null)
Expand All @@ -36,6 +38,16 @@ public function logo($logo = null)
return $this->withMeta(['logo' => $this->_renderImage($logo)]);
}

public function indexSize(int $size)
{
return $this->withMeta(['indexSize' => $size]);
}

public function detailSize(int $size)
{
return $this->withMeta(['detailSize' => $size]);
}

protected function _renderImage($url = null)
{
if ($url and curl_init($url)) {
Expand Down
1 change: 0 additions & 1 deletion webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ let mix = require('laravel-mix')

mix.setPublicPath('dist')
.js('resources/js/field.js', 'js')
.sass('resources/sass/field.scss', 'css')

0 comments on commit 34b50c1

Please sign in to comment.