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 9 commits into
base: main
Choose a base branch
from
Open

Add a CMS Starter example #134

wants to merge 9 commits into from

Conversation

triozer
Copy link
Member

@triozer triozer commented Dec 13, 2024

Description

This pull request introduces a new CMS starter example, including updates to various configuration files, data sources, and UI components. The changes aim to set up a basic CMS plugin for Framer, providing a template for further development.

QA

  • Clone the repository.
  • Navigate to the examples/cms directory.
  • Install dependencies and start the plugin locally.
  • Adding a new Collection
    • Create a new collection.
    • Open the CMS plugin.
      • Confirm a prompt appears asking to select a collection to sync.
      • Verify you can select from the available collections.
  • Managing an existing Collection
    • Open an existing collection that has been set up previously.
    • Click the "Manage" button.
      • Confirm the "Field Mapping UI" is displayed.
      • Verify you can:
        • Change the slug field to a valid string field.
        • Rename fields.
        • Toggle fields on/off by clicking them.
  • Syncing an existing Collection
    • Open an existing, pre-configured collection.
    • Click the "Sync" button.
      • Confirm the sync process starts immediately.
      • Verify the collection syncs with the configured data source without further setup.

Additional Checks

  • Ensure all UI elements are properly styled and responsive.
  • Confirm error states are handled gracefully.
  • Verify field changes persist after saving.
  • Ensure sync operations display appropriate loading states.

Signed-off-by: Cédric Boirard <cedric@framer.com>
Signed-off-by: Cédric Boirard <cedric@framer.com>
Signed-off-by: Cédric Boirard <cedric@framer.com>
@triozer triozer force-pushed the feature/cms-starter branch from d5d0288 to 80d249f Compare December 19, 2024 10:10
@triozer triozer marked this pull request as ready for review December 19, 2024 10:31
@tom-james-watson tom-james-watson self-requested a review December 19, 2024 12:12
examples/cms-starter/datasources/categories.json Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
examples/cms-starter/src/App.tsx Outdated Show resolved Hide resolved
examples/cms-starter/.gitignore Outdated Show resolved Hide resolved
examples/cms-starter/README.md Outdated Show resolved Hide resolved
examples/cms-starter/src/utils.ts Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
examples/cms-starter/index.html Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
- Chore

Signed-off-by: Cédric Boirard <cedric@framer.com>
@huntercaron
Copy link
Collaborator

Lets call the actual folder "cms" instead of "cms-starter" since its already in a folder called "examples"

examples/cms-starter/src/App.tsx Outdated Show resolved Hide resolved
examples/cms-starter/src/FieldMapping.tsx Outdated Show resolved Hide resolved
Comment on lines +42 to +54
userEditable: false,
})
break
case "string":
case "number":
case "boolean":
case "color":
case "formattedText":
fields.push({
id: fieldId,
name: fieldId,
type: field.type,
userEditable: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userEditable is optional and something we are probably going to deprecate, shall we just not include it in the example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not optional yet:

/**
 * Any kind of collection field definition that was created by a plugin and is
 * supported by the API.
 */
type ManagedCollectionField = SupportedCollectionField & {
    /** Is the user able to edit the field within the UI. */
    userEditable: boolean;
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no. Let's make it optional ASAP

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhhh, actually, I think we should use the type

export type EditableManagedCollectionField = SupportedCollectionField &
    Partial<Pick<ManagedCollectionField, "userEditable">>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is not exported by framer-plugin

@jonastreub
Copy link
Contributor

In Safari just clicking the field toggle button results in the text being selected, making it clear it isn't actually a button

image

@jonastreub
Copy link
Contributor

Because there is only a single plain text field its impossible to QA if the slug field selector works as expected when there are multiple options

Copy link
Contributor

@jonastreub jonastreub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last few details. Getting really close now. Great work 👏

examples/cms/src/App.css Outdated Show resolved Hide resolved
Comment on lines +21 to +26
.no-scrollbar::-webkit-scrollbar {
display: none;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets move this into framer.css as "framer-hide-scrollbar"

Comment on lines +30 to +39
[data-framer-theme="light"] .scroll-fade {
background: linear-gradient(to bottom, transparent, white);
}

[data-framer-theme="dark"] .scroll-fade {
background: linear-gradient(180deg, rgba(18, 18, 18, 0) 0%, rgb(17, 17, 17) 97.8%);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

into framer.css as "framer-scroll-fade-vertical"

Comment on lines +156 to +154
.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;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in use

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no, this is the one in use not the .scroll-fade

examples/cms/src/App.tsx Outdated Show resolved Hide resolved
examples/cms/src/data.ts Outdated Show resolved Hide resolved
@huntercaron
Copy link
Collaborator

Screenshot 2024-12-31 at 11 01 18

inbetween the two states there is this inbetween size that makes it feel jumpy

@triozer triozer force-pushed the feature/cms-starter branch from 11826bb to 54abe15 Compare December 31, 2024 11:22
@triozer
Copy link
Member Author

triozer commented Dec 31, 2024

In Safari just clicking the field toggle button results in the text being selected, making it clear it isn't actually a button

@jonastreub fixed this by making it a real button (will benefit of accessibility too)

Because there is only a single plain text field its impossible to QA if the slug field selector works as expected when there are multiple options

I added a new plain text field to categories!

Copy link
Contributor

@jonastreub jonastreub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those were the last few nits code wise. Stellar work 👏

@jonastreub
Copy link
Contributor

Just QA'd and it works flawlessly now ❤️

Signed-off-by: Cédric Boirard <cedric@framer.com>
Signed-off-by: Cédric Boirard <cedric@framer.com>
@triozer
Copy link
Member Author

triozer commented Jan 2, 2025

inbetween the two states there is this inbetween size that makes it feel jumpy

cc @huntercaron using useEffect instead of useLayoutEffect seems to fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants