Skip to content

Commit

Permalink
Merge pull request #276 from DissNik/2.0-components
Browse files Browse the repository at this point in the history
2.0 components
  • Loading branch information
DissNik authored Nov 1, 2023
2 parents e9253f4 + c4e63cd commit 5e3c3a8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
['slug' => 'components-decoration_block', 'label' => 'Block', 'title' => 'Decoration Block'],
['slug' => 'components-decoration_collapse', 'label' => 'Collapse', 'title' => 'Decoration Collapse'],
['slug' => 'components-decoration_divider', 'label' => 'Divider', 'title' => 'Decoration Divider'],
['slug' => 'components-decoration_fragment', 'label' => 'Fragment', 'title' => 'Decoration Fragment'],
['slug' => 'components-decoration_heading', 'label' => 'Heading', 'title' => 'Decoration Heading'],
['slug' => 'components-decoration_layout', 'label' => 'Layout', 'title' => 'Decoration Layout'],
['slug' => 'components-decoration_tabs', 'label' => 'Tabs', 'title' => 'Decoration Tabs'],
Expand Down
49 changes: 49 additions & 0 deletions resources/views/pages/ru/components/decoration_fragment.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<x-page
title="Декоратор Fragment"
:sectionMenu="[
'Разделы' => [
['url' => '#make', 'label' => 'Make'],
]
]"
>

<x-sub-title id="make">Make</x-sub-title>

<x-p>
Иногда может потребоваться вернуть только часть шаблона в вашем HTTP ответе. Для это можно воспользоваться
<x-link link="https://laravel.com/docs/blade#rendering-blade-fragments" target="_blank">Blade Fragments</x-link>.<br />
Декоратор <em>Fragment</em> позволяет создавать соответствующие блоки.
</x-p>

<x-p>
Создать <em>Fragment</em> можно воспользовавшись статическим методом <code>make()</code>.
</x-p>

<x-code language="php">
make(array $fields = [])
</x-code>

<x-p>
Метод <code>name()</code> задает название для фрагмента.
</x-p>

<x-code language="php">
use MoonShine\Decorations\Fragment; // [tl! focus]
use MoonShine\Fields\Text;

//...

public function components(): array
{
return [
Fragment::make([ // [tl! focus]
Text::make('Name', 'first_name')
])
->name('fragment-name') // [tl! focus]
];
}

//...
</x-code>

</x-page>
11 changes: 10 additions & 1 deletion resources/views/pages/ru/components/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@

<x-p>
<em>Decorations</em> - компоненты используются для визуального оформления пользовательского интерфейса:
Block, Collapse, Divider, Flex, Fragment, Grid, Heading, LineBreak, Tabs, TextBlock.
<x-link link="{{ route('moonshine.page', 'components-decoration_block') }}">Block</x-link>,
<x-link link="{{ route('moonshine.page', 'components-decoration_collapse') }}">Collapse</x-link>,
<x-link link="{{ route('moonshine.page', 'components-decoration_divider') }}">Divider</x-link>,
<x-link link="{{ route('moonshine.page', 'components-decoration_layout') . '#flex' }}">Flex</x-link>,
<x-link link="{{ route('moonshine.page', 'components-decoration_fragment') }}">Fragment</x-link>,
<x-link link="{{ route('moonshine.page', 'components-decoration_layout') . '#grid-column' }}">Grid</x-link>,
<x-link link="{{ route('moonshine.page', 'components-decoration_heading') }}">Heading</x-link>,
LineBreak,
<x-link link="{{ route('moonshine.page', 'components-decoration_tabs') }}">Tabs</x-link>,
TextBlock.
</x-p>

<x-p>
Expand Down
5 changes: 5 additions & 0 deletions resources/views/pages/ru/page/class.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ public function components(): array // [tl! focus:start]
}
</x-code>

<x-moonshine::alert type="default" icon="heroicons.book-open">
За более подробной информацией обратитесь к разделу
<x-link link="{{ route('moonshine.page', 'components-index') }}">Components</x-link>.
</x-moonshine::alert>

<x-sub-title id="breadcrumbs">Хлебные крошки</x-sub-title>

<x-p>
Expand Down

0 comments on commit 5e3c3a8

Please sign in to comment.