Skip to content

Commit

Permalink
[TASK] styleguide: Avoid prism syntax hightlighting for now
Browse files Browse the repository at this point in the history
#456

To prepare a monorepo merge of the styleguide
extension, we're for now removing the code example
syntax highlighting of the module to avoid a
JS dependency. We may later add something again.
  • Loading branch information
lolli42 authored Oct 30, 2023
1 parent a51e5bd commit 9cdaa4e
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 603 deletions.
17 changes: 0 additions & 17 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac

private function indexAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'index');
Expand Down Expand Up @@ -154,7 +153,6 @@ private function tcaDeleteAction(): ResponseInterface

private function buttonsAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'buttons');
Expand All @@ -167,7 +165,6 @@ private function buttonsAction(ServerRequestInterface $request): ResponseInterfa

private function typographyAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'typography');
Expand All @@ -180,7 +177,6 @@ private function typographyAction(ServerRequestInterface $request): ResponseInte

private function colorsAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'colors');
Expand All @@ -193,7 +189,6 @@ private function colorsAction(ServerRequestInterface $request): ResponseInterfac

private function treesAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'trees');
Expand All @@ -206,7 +201,6 @@ private function treesAction(ServerRequestInterface $request): ResponseInterface

private function tablesAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'tables');
Expand All @@ -219,7 +213,6 @@ private function tablesAction(ServerRequestInterface $request): ResponseInterfac

private function cardsAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'cards');
Expand Down Expand Up @@ -265,7 +258,6 @@ private function frontendDeleteAction(): ResponseInterface

private function iconsAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$this->pageRenderer->loadJavaScriptModule('@typo3/styleguide/find-icons.js');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
Expand All @@ -290,7 +282,6 @@ function ($key) {

private function infoboxAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'infobox');
Expand All @@ -303,7 +294,6 @@ private function infoboxAction(ServerRequestInterface $request): ResponseInterfa

private function flashMessagesAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'flashMessages');
Expand All @@ -326,7 +316,6 @@ private function flashMessagesAction(ServerRequestInterface $request): ResponseI

private function notificationsAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$this->pageRenderer->loadJavaScriptModule('@typo3/styleguide/render-notifications.js');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
Expand All @@ -340,7 +329,6 @@ private function notificationsAction(ServerRequestInterface $request): ResponseI

private function avatarAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'avatar');
Expand All @@ -354,7 +342,6 @@ private function avatarAction(ServerRequestInterface $request): ResponseInterfac

private function tabAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'tab');
Expand All @@ -367,7 +354,6 @@ private function tabAction(ServerRequestInterface $request): ResponseInterface

private function modalAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'modal');
Expand All @@ -380,7 +366,6 @@ private function modalAction(ServerRequestInterface $request): ResponseInterface

private function accordionAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'accordion');
Expand All @@ -393,7 +378,6 @@ private function accordionAction(ServerRequestInterface $request): ResponseInter

private function paginationAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
$this->addShortcutButton($moduleTemplate, 'pagination');
Expand Down Expand Up @@ -447,7 +431,6 @@ private function paginationAction(ServerRequestInterface $request): ResponseInte

private function filterAction(ServerRequestInterface $request): ResponseInterface
{
$this->pageRenderer->addJsFile('EXT:styleguide/Resources/Public/JavaScript/prism.js');
$this->pageRenderer->addCssFile('EXT:styleguide/Resources/Public/Css/backend.css');
$this->pageRenderer->loadJavaScriptModule('@typo3/styleguide/filter.js');
$moduleTemplate = $this->moduleTemplateFactory->create($request);
Expand Down
75 changes: 0 additions & 75 deletions Resources/Private/Styles/_components/_example.scss

This file was deleted.

23 changes: 0 additions & 23 deletions Resources/Private/Styles/_components/_icon.scss

This file was deleted.

15 changes: 0 additions & 15 deletions Resources/Private/Styles/_components/_navigation.scss

This file was deleted.

82 changes: 75 additions & 7 deletions Resources/Private/Styles/backend.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,77 @@
/** Styles only for EXT: styleguide */
// Navigation scaffold
@media (min-width: 769px) {
#container-navigation {
position: fixed;
width: 260px;
}
#container-content {
margin-left: 300px;
}
@media (max-height: 660px) {
#container-navigation {
position: absolute;
}
}
}

// Include prism default styles
@import "vendor/prism";
// Example
.example {
background-color: var(--typo3-component-bg);
border: var(--typo3-component-border-width) solid var(--typo3-component-border-color);
padding: var(--typo3-spacing);
margin-bottom: var(--typo3-spacing);
& + *:not(.example) {
margin-top: var(--typo3-component-spacing);
}
&:before {
content: 'EXAMPLE';
display: block;
font-weight: normal;
font-size: 0.9em;
margin-bottom: var(--typo3-spacing);
}
&.code {
font-family: var(--typo3-font-family-code);
&:before {
content: 'EXAMPLE CODE';
}
}
pre {
font-size: var(--typo3-component-font-size);
margin: 0;
}
pre[class*="language-"] {
border-radius: calc(var(--typo3-component-border-radius) / 2);
color: var(--typo3-component-color);
margin: 0;
}
pre code {
overflow: auto;
width: 100%;
display: block;
}
}

// Custom components
@import "_components/_navigation";
@import "_components/_example";
@import "_components/_icon";
// Icon module
div.icon-container {
border: 1px solid transparent;
margin-bottom: 20px;
height: 100px;

&.icon-deprecated-container {
height: 175px;
}

span.icon-container-icon,
span.icon-container-label {
display: block;
text-align: center;
background-color: #eee;
min-height: 50px;
padding: 5px;
}
&:hover span.icon-container-icon,
&:hover span.icon-container-label {
background-color: #e1e1e1;
}
}
Loading

0 comments on commit 9cdaa4e

Please sign in to comment.