Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CMS Starter example #134

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
1,927 changes: 1,791 additions & 136 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"private": true,
"license": "MIT",
"workspaces": [
"starters/*",
"plugins/*"
],
"scripts": {
Expand Down
19 changes: 19 additions & 0 deletions starters/cms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CMS Starter

This is a starter for building a CMS plugin for Framer.

Run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

And [open in Framer](https://www.framer.com/developers/plugins/quick-start#opening-in-framer).

Learn more: https://www.framer.com/developers/plugins/introduction
53 changes: 53 additions & 0 deletions starters/cms/datasources/articles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"id": "articles",
"fields": [
{
"name": "Title",
"type": "string"
},
{
"name": "Content",
"type": "html"
},
{
"name": "Reading time",
"type": "number"
},
{
"name": "Featured",
"type": "boolean"
}
],
"items": [
{
"Title": "Getting Started",
"Reading time": 3,
"Featured": true,
"Content": "<h2>Editing Content</h2><blockquote><p>You can choose to set up different types of input fields depending on your content...</p></blockquote>..."
},
{
"Title": "What's New",
"Reading time": 2,
"Featured": false,
"Content": "<h2>Reference Fields</h2>..."
},
{
"Title": "Styling Elements",
"Reading time": 4,
"Featured": false,
"Content": "<h2>Reference Fields</h2>..."
},
{
"Title": "Importing Content",
"Reading time": 6,
"Featured": false,
"Content": "<h2>Prepare your CSV file</h2><p>Make sure your file is exported as a \"CSV\" file...</p>"
},
{
"Title": "Best Practices",
"Reading time": 8,
"Featured": true,
"Content": "<h3>Choose Compelling Topics</h3><p>Use analytics tools to understand demographic data and user behavior...</p>"
}
]
}
39 changes: 39 additions & 0 deletions starters/cms/datasources/categories.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"id": "categories",
"fields": [
{
"name": "Title",
"type": "string"
},
{
"name": "Description",
"type": "string"
},
{
"name": "Color",
"type": "color"
}
],
"items": [
{
"Title": "CMS",
"Description": "Content Management System",
"Color": "orange"
},
{
"Title": "Basics",
"Description": "Basic content management",
"Color": "red"
},
{
"Title": "Updates",
"Description": "Updates to the CMS",
"Color": "blue"
},
{
"Title": "Pro Tips",
"Description": "Tips for using the CMS",
"Color": "green"
}
]
}
25 changes: 25 additions & 0 deletions starters/cms/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import js from "@eslint/js"
import globals from "globals"
import reactHooks from "eslint-plugin-react-hooks"
import reactRefresh from "eslint-plugin-react-refresh"
import tseslint from "typescript-eslint"

export default tseslint.config(
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2022,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
},
}
)
6 changes: 6 additions & 0 deletions starters/cms/framer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "72745a",
"name": "CMS Starter",
"modes": ["configureManagedCollection", "syncManagedCollection"],
"icon": "/icon.svg"
}
13 changes: 13 additions & 0 deletions starters/cms/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CMS Starter</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
35 changes: 35 additions & 0 deletions starters/cms/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "cms-starter",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"pack": "npx framer-plugin-tools@latest pack"
},
"dependencies": {
"framer-plugin": "^2",
"motion": "^11.13.4",
"react": "^18",
"react-dom": "^18",
"vite-plugin-mkcert": "^1"
},
"devDependencies": {
"@eslint/js": "^9",
"@types/react-dom": "^18",
"@types/react": "^18",
"@vitejs/plugin-react-swc": "^3",
"@vitejs/plugin-react": "^4.3.1",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.9",
"typescript-eslint": "^8.0.1",
"vite-plugin-framer": "^1",
"eslint": "^9.9.0",
"globals": "^15.9.0",
"typescript": "^5.3",
"vite": "^6"
}
}
4 changes: 4 additions & 0 deletions starters/cms/public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
144 changes: 144 additions & 0 deletions starters/cms/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/* Your Plugin CSS */

main {
display: flex;
flex-direction: column;
align-items: start;
padding: 0 15px 15px;
height: 100%;
gap: 15px;

user-select: none;
-webkit-user-select: none;
}

form {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
gap: 15px;
}

.sticky-top {
position: sticky;
top: 0;
}

.field-input {
width: 100%;
flex-shrink: 1;
}

.column-span-2 {
grid-column: span 2 / span 2;
}

.loading {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}

.setup .logo {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
min-height: 200px;
background-color: var(--framer-color-bg-secondary);
border-radius: 10px;
}

.setup label {
display: flex;
flex-direction: row;
align-items: center;
height: 30px;
width: 100%;
justify-content: space-between;
padding-left: 15px;
color: var(--framer-color-text-secondary);
}

.setup select {
width: 164px;
text-transform: capitalize;
}

.mapping {
padding-bottom: 0;
}

.mapping .fields {
display: grid;
grid-template-columns: 1fr 8px 1fr;
gap: 10px;
margin-bottom: auto;
padding-bottom: 10px;
align-items: center;
color: var(--framer-color-text-tertiary);
}

.mapping .slug-field {
display: flex;
flex-direction: column;
width: 100%;
justify-content: space-between;
gap: 10px;
color: var(--framer-color-text-tertiary);
}

.mapping .source-field {
display: flex;
flex-direction: row;
align-items: center;
white-space: nowrap;
font-weight: 500;
background-color: var(--framer-color-bg-tertiary);
gap: 8px;
}

.mapping .source-field[aria-disabled="true"] {
opacity: 0.5;
}

.mapping .source-field:focus-visible {
outline: none;
box-shadow: inset 0 0 0 1px var(--framer-color-tint);
}

.mapping .source-field input[type="checkbox"] {
cursor: pointer;
}

.mapping .source-field input[type="checkbox"]:focus {
box-shadow: none;
}

.mapping footer {
position: sticky;
bottom: 0;
left: 0;
width: 100%;
background-color: var(--framer-color-bg);
margin-top: auto;
padding-bottom: 15px;
display: flex;
flex-direction: column;
gap: 15px;
}

.mapping footer::before {
content: "";
position: absolute;
top: -45px;
left: 0;
width: 100%;
height: 45px;
background: linear-gradient(to bottom, transparent, var(--framer-color-bg));
pointer-events: none;
}
Loading