New code display

This commit is contained in:
Cagatay Civici 2022-12-06 11:49:15 +03:00
parent 65da59874b
commit 91eb738476
13 changed files with 433 additions and 452 deletions

View File

@ -1,19 +0,0 @@
import { Component, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-code',
template: `
<pre class="surface-ground p-5 border-round mb-3"><code class="-mt-4 p-0 line-height-3 block overflow-auto" [ngStyle]="{'font-family': 'monaco, Consolas, monospace'}"><ng-content></ng-content></code></pre>
`
})
export class AppCodeComponent {
}
@NgModule({
imports: [CommonModule],
exports: [AppCodeComponent],
declarations: [AppCodeComponent]
})
export class AppCodeModule { }

View File

@ -4,25 +4,21 @@
<h4>Getting Started</h4>
<p>Sakai is an application template for Angular and is distributed as a CLI project. Current versions is Angular v14 with PrimeNG v14. In case CLI is not installed already, use the command below to set it up.</p>
<app-code ngPreserveWhitespaces ngNonBindable lang="markup">
npm install -g @angular/cli
</app-code>
<pre class="app-code"><code>npm install -g @angular/cli</code></pre>
<p>Once CLI is ready in your system, extract the contents of the zip file distribution, cd to the directory,
install the libraries from npm and then execute "ng serve" to run the application in your local environment.</p>
<app-code ngPreserveWhitespaces ngNonBindable lang="markup">
cd sakai
<pre class="app-code"><code>cd sakai
npm install
ng serve
</app-code>
ng serve</code></pre>
<p>The application should run at <span class="font-semibold">http://localhost:4200/</span>, you may now start with the development of your application.</p>
<h5>Important CLI Commands</h5>
<p>Following commands are derived from CLI.</p>
<app-code ngPreserveWhitespaces ngNonBindable lang="markup">
Run 'ng serve' for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
<pre class="app-code"><code>Run 'ng serve' for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
Run 'ng generate component component-name' to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.
@ -32,8 +28,7 @@ Run 'ng test' to execute the unit tests via [Karma](https://karma-runner.github.
Run 'ng e2e' to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Run 'ng help' for more options.
</app-code>
Run 'ng help' for more options.</code></pre>
<h4>Structure</h4>
<p>Sakai consists of 3 main parts; the application layout, layout assets and PrimeNG component theme assets. Layout is placed inside the <span class="text-primary font-medium">src/app/layout</span> folder,
@ -46,8 +41,7 @@ Run 'ng help' for more options.
initial scale is defined with the <span class="text-primary font-medium">$scale</span> at <strong class="font-semibold">layout.scss</strong>. When default theme or scale is changed at their files initially, it is required to configure the layout service with the matching values
to avoid sync issues. </p>
<app-code ngPreserveWhitespaces ngNonBindable lang="javascript">
import &#123; Component, OnInit &#125; from '@angular/core';
<pre class="app-code"><code>import &#123; Component, OnInit &#125; from '@angular/core';
import &#123; PrimeNGConfig &#125; from 'primeng/api';
import &#123; LayoutService &#125; from './layout/service/app.layout.service';
@ -73,15 +67,13 @@ export class AppComponent implements OnInit &#123;
&#125;;
&#125;
&#125;
</app-code>
&#125;</code></pre>
<h5>Menu</h5>
<p>Menu is a separate component defined in <span class="text-primary font-medium">src/app/layout/app.menu.component.ts</span> file and based on PrimeNG MenuModel API. In order to define the menuitems,
navigate to this file and define your own model as a nested structure.</p>
<app-code ngPreserveWhitespaces ngNonBindable lang="javascript">
import &#123; OnInit &#125; from '@angular/core';
<pre class="app-code"><code>import &#123; OnInit &#125; from '@angular/core';
import &#123; Component &#125; from '@angular/core';
@Component(&#123;
@ -107,8 +99,7 @@ export class AppMenuComponent implements OnInit &#123;
//...
];
&#125;
&#125;
</app-code>
&#125;</code></pre>
<h4>Integration with Existing Angular CLI Projects</h4>
<p>Sakai structure is designed in a modular way so that it can easily be integrated with your existing application. We've created a short tutorial with details.</p>

View File

@ -0,0 +1,16 @@
@media screen and (max-width: 991px) {
.video-container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
}

View File

@ -1,6 +1,7 @@
import { Component } from '@angular/core';
@Component({
templateUrl: './documentation.component.html'
templateUrl: './documentation.component.html',
styleUrls: ['./documentation.component.scss']
})
export class DocumentationComponent { }

View File

@ -1,13 +1,11 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DocumentationRoutingModule } from './documentation-routing.module';
import { AppCodeModule } from '../code/code.component';
import { DocumentationComponent } from './documentation.component';
@NgModule({
imports: [
CommonModule,
AppCodeModule,
DocumentationRoutingModule
],
declarations: [DocumentationComponent]

View File

@ -12,6 +12,7 @@ export class BlocksComponent {
<span class="block text-6xl font-bold mb-1">Create the screens your</span>
<div class="text-6xl text-primary font-bold mb-3">your visitors deserve to see</div>
<p class="mt-0 mb-4 text-700 line-height-3">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<button pButton pRipple label="Learn More" type="button" class="mr-3 p-button-raised"></button>
<button pButton pRipple label="Live Demo" type="button" class="p-button-outlined"></button>
</section>
@ -78,6 +79,7 @@ export class BlocksComponent {
<div class="surface-ground px-4 py-8 md:px-6 lg:px-8">
<div class="text-900 font-bold text-6xl mb-4 text-center">Pricing Plans</div>
<div class="text-700 text-xl mb-6 text-center line-height-3">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Velit numquam eligendi quos.</div>
<div class="grid">
<div class="col-12 lg:col-4">
<div class="p-3 h-full">
@ -109,6 +111,7 @@ export class BlocksComponent {
</div>
</div>
</div>
<div class="col-12 lg:col-4">
<div class="p-3 h-full">
<div class="shadow-2 p-3 h-full flex flex-column surface-card" style="border-radius: 6px">
@ -143,6 +146,7 @@ export class BlocksComponent {
</div>
</div>
</div>
<div class="col-12 lg:col-4">
<div class="p-3 h-full">
<div class="shadow-2 p-3 flex flex-column surface-card" style="border-radius: 6px">
@ -324,11 +328,14 @@ export class BlocksComponent {
<span class="text-600 font-medium line-height-3">Don't have an account?</span>
<a class="font-medium no-underline ml-2 text-blue-500 cursor-pointer">Create today!</a>
</div>
<div>
<label for="email1" class="block text-900 font-medium mb-2">Email</label>
<input id="email1" type="text" pInputText class="w-full mb-3">
<label for="password1" class="block text-900 font-medium mb-2">Password</label>
<input id="password1" type="password" pInputText class="w-full mb-3">
<div class="flex align-items-center justify-content-between mb-6">
<div class="flex align-items-center">
<p-checkbox id="rememberme1" [binary]="true" styleClass="mr-2"></p-checkbox>
@ -336,6 +343,7 @@ export class BlocksComponent {
</div>
<a class="font-medium no-underline ml-2 text-blue-500 text-right cursor-pointer">Forgot password?</a>
</div>
<button pButton pRipple label="Sign In" icon="pi pi-user" class="w-full"></button>
</div>
</div>`;

View File

@ -1,14 +1,13 @@
.block-section {
margin-bottom: 4rem;
overflow: hidden;
}
.block-header {
padding: 1rem 2rem;
background-color: var(--surface-section);
border-top-left-radius: 12px;
border-top-right-radius: 12px;
border:1px solid var(--surface-d);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border:1px solid var(--surface-border);
display: flex;
align-items: center;
justify-content: space-between;
@ -42,7 +41,6 @@
margin-right: .75rem;
padding: .5rem 1rem;
border-radius: 4px;
font-weight: 600;
border: 1px solid transparent;
transition: background-color .2s;
cursor: pointer;
@ -52,7 +50,7 @@
}
&:not(.block-action-disabled):hover {
background-color: var(--surface-c);
background-color: var(--surface-hover);
}
&.block-action-active {
@ -81,29 +79,17 @@
.block-content {
padding: 0;
border:1px solid var(--surface-d);
border:1px solid var(--surface-border);
border-top: 0 none;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
overflow: hidden;
}
:host ::ng-deep pre[class*="language-"] {
margin: 0 !important;
border-radius: 0 !important;
&:before, &:after {
display: none !important;
}
pre.app-code {
background-color: var(--surface-card) !important;
padding-bottom: 1rem !important;
margin-bottom: 0 !important;
code {
border-left: 0 none !important;
box-shadow: none !important;
background: var(--surface-e) !important;
margin: 0;
color: var(--text-color);
font-size: 14px;
padding: 0 2rem !important;
padding: 1rem 2.5rem;
}
}
}

View File

@ -30,8 +30,7 @@ enum BlockView {
<ng-content></ng-content>
</div>
<div *ngIf="blockView === BlockView.CODE">
<app-code lang="markup" ngPreserveWhitespaces>{{code}}
</app-code>
<pre class="app-code"><code>{{code}}</code></pre>
</div>
</div>
</div>

View File

@ -3,7 +3,6 @@ import { CommonModule } from '@angular/common';
import { BlocksComponent } from './blocks/blocks.component';
import { PrimeBlocksRoutingModule } from './primeblocks-routing.module';
import { BlockViewerComponent } from './blockviewer/blockviewer.component'
import { AppCodeModule } from '../code/code.component';
import { ChipModule } from 'primeng/chip';
import { CheckboxModule } from 'primeng/checkbox';
import { ButtonModule } from 'primeng/button';
@ -16,7 +15,6 @@ import { TooltipModule } from 'primeng/tooltip';
@NgModule({
imports: [
CommonModule,
AppCodeModule,
ButtonModule,
RippleModule,
ChipModule,
@ -25,8 +23,7 @@ import { TooltipModule } from 'primeng/tooltip';
InputTextModule,
PasswordModule,
TooltipModule,
PrimeBlocksRoutingModule,
AppCodeModule
PrimeBlocksRoutingModule
],
declarations: [BlocksComponent, BlockViewerComponent]
})

View File

@ -1,18 +1,14 @@
<div class="card">
<h2>Icons</h2>
<h4>Download</h4>
<app-code lang="markup" ngPreserveWhitespaces ngNonBindable>
npm install primeicons --save
</app-code>
<pre class="app-code"><code>npm install primeicons --save</code></pre>
<h4>Getting Started</h4>
<p>PrimeIcons use the <strong>pi pi-&#123;icon&#125;</strong> syntax such as <strong>pi pi-check</strong>.
A standalone icon can be displayed using an element such as <i>i</i> or <i>span</i></p>
<app-code lang="markup" ngPreserveWhitespaces ngNonBindable>
&lt;i class="pi pi-check"&gt;&lt;/i&gt;
&lt;i class="pi pi-times"&gt;&lt;/i&gt;
</app-code>
<pre class="app-code"><code>&lt;i class="pi pi-check"&gt;&lt;/i&gt;
&lt;i class="pi pi-times"&gt;&lt;/i&gt;</code></pre>
<i class="pi pi-check" style="margin-right: .5rem"></i>
<i class="pi pi-times"></i>
@ -20,24 +16,18 @@ npm install primeicons --save
<h4>Size</h4>
<p>Size of the icons can easily be changed using font-size property.</p>
<app-code lang="markup" ngPreserveWhitespaces ngNonBindable>
&lt;i class="pi pi-check"&gt;&lt;/i&gt;
</app-code>
<pre class="app-code"><code>&lt;i class="pi pi-check"&gt;&lt;/i&gt;</code></pre>
<i class="pi pi-check"></i>
<app-code lang="markup" ngPreserveWhitespaces ngNonBindable>
&lt;i class="pi pi-check" style="font-size: 2rem"&gt;&lt;/i&gt;
</app-code>
<pre class="app-code"><code>&lt;i class="pi pi-check" style="font-size: 2rem"&gt;&lt;/i&gt;</code></pre>
<i class="pi pi-check" style="font-size: 2rem"></i>
<h4>Spinning Animation</h4>
<p>Special pi-spin class applies infinite rotate to an icon.</p>
<app-code lang="markup" ngPreserveWhitespaces ngNonBindable>
&lt;i class="pi pi-spin pi-spinner" style="font-size: 2rem"&gt;&lt;/i&gt;
</app-code>
<pre class="app-code"><code>&lt;i class="pi pi-spin pi-spinner" style="font-size: 2rem"&gt;&lt;/i&gt;</code></pre>
<i class="pi pi-spin pi-spinner" style="font-size: 2rem"></i>

View File

@ -2,15 +2,13 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IconsComponent } from './icons/icons.component';
import { UtilitiesRoutingModule } from './utilities-routing.module';
import { AppCodeModule } from '../code/code.component';
import { InputTextModule } from 'primeng/inputtext';
@NgModule({
imports: [
CommonModule,
UtilitiesRoutingModule,
AppCodeModule,
InputTextModule,
InputTextModule
],
declarations: [IconsComponent]
})

View File

@ -0,0 +1,15 @@
pre.app-code {
background-color: var(--surface-ground);
margin: 0 0 1rem 0;
padding: 0;
border-radius: var(--border-radius);
overflow: auto;
code {
color: var(--surface-900);
padding: 1rem;
line-height: 1.5;
display: block;
font-family: monaco, Consolas, monospace;
}
}

View File

@ -11,3 +11,4 @@ $gutter: 1rem; //for primeflex grid system
/* Demos */
@import "assets/demo/styles/flags/flags.css";
@import "assets/demo/styles/badges.scss";
@import "assets/demo/styles/code.scss";