Files
payload/test/fields/collections/Code/index.tsx
2023-09-01 14:45:41 -04:00

127 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
import type { CodeField } from '../../payload-types'
const Code: CollectionConfig = {
fields: [
{
admin: {
language: 'javascript',
},
name: 'javascript',
type: 'code',
},
{
admin: {
language: 'typescript',
},
name: 'typescript',
type: 'code',
},
{
admin: {
language: 'json',
},
name: 'json',
type: 'code',
},
{
admin: {
language: 'html',
},
name: 'html',
type: 'code',
},
{
admin: {
language: 'css',
},
name: 'css',
type: 'code',
},
],
slug: 'code-fields',
}
export const codeDoc: Partial<CodeField> = {
css: `@import url(https://fonts.googleapis.com/css?family=Questrial);
@import url(https://fonts.googleapis.com/css?family=Arvo);
@font-face {
src: url(https://lea.verou.me/logo.otf);
font-family: 'LeaVerou';
}
/*
Shared styles
*/
section h1,
#features li strong,
header h2,
footer p {
font: 100% Rockwell, Arvo, serif;
}
/*
Styles
*/
* {
margin: 0;
padding: 0;
}
body {
font: 100%/1.5 Questrial, sans-serif;
tab-size: 4;
hyphens: auto;
}
a {
color: inherit;
}
section h1 {
font-size: 250%;
}`,
html: `<!DOCTYPE html>
<html lang="en">
<head>
<script>
// Just a lil script to show off that inline JS gets highlighted
window.console && console.log('foo');
</script>
<meta charset="utf-8" />
<link rel="icon" href="assets/favicon.png" />
<title>Prism</title>
<link rel="stylesheet" href="assets/style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<script src="assets/vendor/prefixfree.min.js"></script>
<script>var _gaq = [['_setAccount', 'UA-11111111-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
</head>
<body>`,
javascript: "console.log('Hello');",
json: JSON.stringify({ arr: ['val1', 'val2', 'val3'], property: 'value' }, null, 2),
typescript: `class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
let greeter = new Greeter("world");`,
}
export default Code