Skip to content

Commit

Permalink
GH-230 Create GalaxyPlanetLink component
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jul 4, 2022
1 parent a534f6c commit 5fdf2c0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/_includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

include($includePath . './exceptions.php');

include($includePath . './components/GalaxyPlanetLink/GalaxyPlanetLink.component.php');

include($includePath . './modules/uni/utils/isEmailDomainBanned.util.php');

include($includePath . './utils/routing/galaxy.routing.php');
Expand Down
26 changes: 26 additions & 0 deletions common/components/GalaxyPlanetLink/GalaxyPlanetLink.component.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace UniEngine\Engine\Common\Components\GalaxyPlanetLink;

use UniEngine\Engine\Common\Utils\Routing;

/**
* @param array $props
* @param array $props['coords']
* @param number $props['coords']['galaxy']
* @param number $props['coords']['system']
* @param number $props['coords']['planet']
*/
function render($props) {
$linkText = "[{$props['coords']['galaxy']}:{$props['coords']['system']}:{$props['coords']['planet']}]";

return buildDOMElementHTML([
'tagName' => 'a',
'contentHTML' => $linkText,
'attrs' => [
'href' => Routing\getGalaxyTargetUrl($props['coords']),
],
]);
}

?>
5 changes: 5 additions & 0 deletions common/components/GalaxyPlanetLink/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

header("Location: ../index.php");

?>
5 changes: 5 additions & 0 deletions common/components/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

header("Location: ../index.php");

?>

0 comments on commit 5fdf2c0

Please sign in to comment.