Merge pull request #2619 from brkcvn/code-clean

HTML structures development
This commit is contained in:
Cüneyt Şentürk
2022-09-07 13:46:21 +03:00
committed by GitHub
89 changed files with 1208 additions and 1339 deletions

View File

@ -0,0 +1,38 @@
<?php
namespace App\View\Components\Form;
use App\Abstracts\View\Component;
use Illuminate\Support\Str;
class Section extends Component
{
public $spacingVertical;
public $spacingHorizontal;
public $columnNumber;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
string $spacingVertical = 'gap-y-6', string $spacingHorizontal = 'gap-x-8', string $columnNumber = 'sm:grid-cols-6',
) {
$this->spacingVertical = $spacingVertical;
$this->spacingHorizontal = $spacingHorizontal;
$this->columnNumber = $columnNumber;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('components.form.section.index');
}
}

View File

@ -11,6 +11,7 @@ class Td extends Component
public $override;
public $kind;
public $hiddenMobile;
/**
* Create a new component instance.
@ -18,11 +19,12 @@ class Td extends Component
* @return void
*/
public function __construct(
string $class = '', string $override = '', string $kind = ''
string $class = '', string $override = '', string $kind = '', bool $hiddenMobile = false,
) {
$this->override = $this->getOverride($override);
$this->kind = $kind;
$this->hiddenMobile = $hiddenMobile;
$this->class = $this->getClass($class);
}
@ -47,6 +49,10 @@ class Td extends Component
return $class;
}
if ($this->hiddenMobile) {
$class = $class . ' ' . 'hidden sm:table-cell';
}
$default = 'py-4 whitespace-nowrap text-sm font-normal text-black truncate';
switch ($this->kind) {
@ -56,6 +62,9 @@ class Td extends Component
case 'right':
$default = $class . ' ltr:pl-6 rtl:pr-6 ltr:text-right rtl:text-left ' . $default;
break;
case 'bulkaction':
$default = $class . 'ltr:pr-6 rtl:pl-6 hidden sm:table-cell';
break;
case 'action':
$default = 'p-0';
break;

View File

@ -12,17 +12,20 @@ class Th extends Component
public $kind;
public $hiddenMobile;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
string $class = '', string $override = '', string $kind = ''
string $class = '', string $override = '', string $kind = '', bool $hiddenMobile = false,
) {
$this->override = $this->getOverride($override);
$this->kind = $kind;
$this->hiddenMobile = $hiddenMobile;
$this->class = $this->getClass($class);
}
@ -47,6 +50,10 @@ class Th extends Component
return $class;
}
if ($this->hiddenMobile) {
$class = $class . ' ' . 'hidden sm:table-cell';
}
$default = 'py-3 text-xs font-medium text-black tracking-wider';
switch ($this->kind) {
@ -56,6 +63,9 @@ class Th extends Component
case 'right':
$default = $class . ' ltr:pl-6 rtl:pr-6 ltr:text-right rtl:text-left' . $default;
break;
case 'bulkaction':
$default = $class . 'ltr:pr-6 rtl:pl-6 hidden sm:table-cell';
break;
default:
$default = $class . ' ltr:pr-6 rtl:pl-6 ltr:text-left rtl:text-right ' . $default;
}

View File

@ -45,6 +45,10 @@ class Tr extends Component
return 'relative flex items-center px-1 group border-b hover:bg-gray-100';
}
else if (array_key_exists('App\View\Components\Table\Thead', $values)) {
return 'flex items-center px-1';
}
return '';
}
}