-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from simonhamp/avatar-layout
Avatar layout
- Loading branch information
Showing
7 changed files
with
142 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace SimonHamp\TheOg\Layout\Layouts; | ||
|
||
use SimonHamp\TheOg\BorderPosition; | ||
use SimonHamp\TheOg\Layout\AbstractLayout; | ||
use SimonHamp\TheOg\Layout\PictureBox; | ||
use SimonHamp\TheOg\Layout\Position; | ||
use SimonHamp\TheOg\Layout\TextBox; | ||
|
||
class Avatar extends AbstractLayout | ||
{ | ||
protected BorderPosition $borderPosition = BorderPosition::Left; | ||
protected int $borderWidth = 25; | ||
protected int $height = 630; | ||
protected int $padding = 40; | ||
protected int $width = 1200; | ||
|
||
public function features(): void | ||
{ | ||
$this->addFeature((new PictureBox()) | ||
->path($this->picture()) | ||
->circle() | ||
->box(300, 300) | ||
->position( | ||
x: 0, | ||
y: 0, | ||
relativeTo: fn () => $this->mountArea()->anchor(Position::Center)->moveY(-100), | ||
anchor: Position::Center, | ||
) | ||
); | ||
|
||
$this->addFeature((new TextBox()) | ||
->text($this->title()) | ||
->color($this->config->theme->getTitleColor()) | ||
->font($this->config->theme->getTitleFont()) | ||
->size(56) | ||
->box($this->mountArea()->box->width() / 1.5, 300) | ||
->position( | ||
x: 0, | ||
y: 0, | ||
relativeTo: fn () => $this->mountArea()->anchor(Position::Center)->moveY(100), | ||
anchor: Position::MiddleTop, | ||
) | ||
); | ||
} | ||
|
||
public function url(): string | ||
{ | ||
return strtoupper(parent::url()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+106 KB
...on/__snapshots__/ImageTest__test_basic_image with data set avatar layout__1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.