-
Notifications
You must be signed in to change notification settings - Fork 50
Renamer prerelease styles #646
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
Open
madebyisaacr
wants to merge
5
commits into
main
Choose a base branch
from
update-renamer-icons
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,65 +1,197 @@ | ||
| import { useMemo } from "react" | ||
| import type { IndexNodeType } from "../search/types" | ||
|
|
||
| interface Props { | ||
| type: IndexNodeType | ||
| isBreakpoint: boolean | ||
| } | ||
|
|
||
| export default function LayerIcon({ type }: Props) { | ||
| const width = 12 | ||
| const height = 12 | ||
| export default function LayerIcon({ type, isBreakpoint }: Props) { | ||
| const isPrerelease = useMemo(() => document.body.getAttribute("data-framer-styles") === "prerelease", []) | ||
|
|
||
| let icon = null | ||
|
|
||
| switch (type) { | ||
| case "TextNode": | ||
| icon = ( | ||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" className="text-icon"> | ||
| <path | ||
| d="M 5.5 4 L 5.5 8.5 M 2.5 3 L 8.5 3" | ||
| fill="transparent" | ||
| strokeWidth="2" | ||
| stroke="currentColor" | ||
| strokeLinecap="round" | ||
| /> | ||
| </svg> | ||
| ) | ||
| break | ||
| if (isPrerelease) { | ||
| switch (type) { | ||
| case "TextNode": | ||
| icon = ( | ||
| <svg | ||
| role="presentation" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="12" | ||
| height="12" | ||
| fill="none" | ||
| className="text-icon" | ||
| > | ||
| <g | ||
| fill="transparent" | ||
| stroke="currentColor" | ||
| strokeLinecap="round" | ||
| strokeMiterlimit="10" | ||
| strokeWidth="1.5" | ||
| > | ||
| <path d="M6.25 2.25V10M2 2.25h8.5" /> | ||
| </g> | ||
| </svg> | ||
| ) | ||
| break | ||
| case "FrameNode": | ||
| icon = isBreakpoint ? ( | ||
| <svg | ||
| role="presentation" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="12" | ||
| height="12" | ||
| fill="none" | ||
| className="frame-icon" | ||
| > | ||
| <defs> | ||
| <clipPath id="breakpoint-clip-path"> | ||
| <path d="M.5 3.5a3 3 0 0 1 3-3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-5a3 3 0 0 1-3-3Z"></path> | ||
| </clipPath> | ||
| </defs> | ||
| <path | ||
| d="M.5 3.5a3 3 0 0 1 3-3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-5a3 3 0 0 1-3-3Z" | ||
| fill="transparent" | ||
| stroke="currentColor" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| strokeWidth="3" | ||
| clipPath="url(#breakpoint-clip-path)" | ||
| /> | ||
| <path | ||
| fill="currentColor" | ||
| fillOpacity="0.2" | ||
| stroke="currentColor" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| d="M10 1.5H2.5l-1 1v2H11v-1Z" | ||
| /> | ||
| </svg> | ||
| ) : ( | ||
| <svg | ||
| role="presentation" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="12" | ||
| height="12" | ||
| fill="none" | ||
| className="frame-icon" | ||
| > | ||
| <path | ||
| fill="currentColor" | ||
| fillOpacity="0.2" | ||
| stroke="currentColor" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| strokeWidth="1.5" | ||
| d="M1.25 3.25a2 2 0 0 1 2-2h5.5a2 2 0 0 1 2 2v5.5a2 2 0 0 1-2 2h-5.5a2 2 0 0 1-2-2Z" | ||
| /> | ||
| </svg> | ||
| ) | ||
| break | ||
|
|
||
| case "FrameNode": | ||
| icon = ( | ||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11 11" className="frame-icon"> | ||
| <path | ||
| d="M 1 2.5 C 1 1.672 1.672 1 2.5 1 L 8.5 1 C 9.328 1 10 1.672 10 2.5 L 10 8.5 C 10 9.328 9.328 10 8.5 10 L 2.5 10 C 1.672 10 1 9.328 1 8.5 Z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| ) | ||
| break | ||
| case "ComponentInstanceNode": | ||
| icon = ( | ||
| <svg | ||
| role="presentation" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="12" | ||
| height="12" | ||
| viewBox="0 0 12 12" | ||
| fill="none" | ||
| aria-hidden="true" | ||
| focusable="false" | ||
| className="component-icon" | ||
| > | ||
| <path | ||
| fill="currentColor" | ||
| fillOpacity="0.2" | ||
| stroke="currentColor" | ||
| strokeWidth="1.5" | ||
| d="M4.586 1.354a2 2 0 0 1 2.828 0l3.232 3.232a2 2 0 0 1 0 2.828l-3.232 3.232a2 2 0 0 1-2.828 0L1.354 7.414a2 2 0 0 1 0-2.828Z" | ||
| /> | ||
| <path fill="none" stroke="currentColor" d="m3 3 6 6M9 3 3 9" /> | ||
| </svg> | ||
| ) | ||
| break | ||
|
|
||
| case "ComponentInstanceNode": | ||
| icon = ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="11" | ||
| height="11" | ||
| viewBox="0 0 11 11" | ||
| className="component-icon" | ||
| > | ||
| <path | ||
| d="M4.44.55a1.5 1.5 0 0 1 2.12 0l1.592 1.591L5.5 4.793 2.848 2.14ZM2.14 8.152.551 6.56a1.5 1.5 0 0 1 0-2.122l1.59-1.59L4.793 5.5Zm8.309-3.713a1.5 1.5 0 0 1 0 2.122L8.859 8.15 6.207 5.5 8.86 2.848Zm-3.89 6.01a1.5 1.5 0 0 1-2.12 0L2.847 8.86 5.5 6.207 8.152 8.86Z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| ) | ||
| break | ||
| default: | ||
| icon = null | ||
| } | ||
| } else { | ||
| switch (type) { | ||
| case "TextNode": | ||
| icon = ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| role="presentation" | ||
| width="12" | ||
| height="12" | ||
| className="text-icon" | ||
| > | ||
| <path | ||
| d="M6 3.5v6M2.25 2.5h7.5" | ||
| fill="transparent" | ||
| strokeWidth="2" | ||
| stroke="currentColor" | ||
| strokeLinecap="round" | ||
| strokeMiterlimit="10" | ||
| /> | ||
| </svg> | ||
| ) | ||
| break | ||
|
|
||
| default: | ||
| icon = null | ||
| case "FrameNode": | ||
| icon = isBreakpoint ? ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="12" | ||
| height="12" | ||
| fill="none" | ||
| role="presentation" | ||
| className="frame-icon" | ||
| > | ||
| <path | ||
| fill="currentColor" | ||
| d="M1 3a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1a.5.5 0 0 1-.5.5h-9A.5.5 0 0 1 1 4Z" | ||
| /> | ||
| <path | ||
| fill="currentColor" | ||
| fillOpacity="0.4" | ||
| d="M1 6a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5v3a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2Z" | ||
| /> | ||
| </svg> | ||
| ) : ( | ||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11 11" className="frame-icon"> | ||
| <path | ||
| d="M 1 2.5 C 1 1.672 1.672 1 2.5 1 L 8.5 1 C 9.328 1 10 1.672 10 2.5 L 10 8.5 C 10 9.328 9.328 10 8.5 10 L 2.5 10 C 1.672 10 1 9.328 1 8.5 Z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| ) | ||
| break | ||
|
|
||
| case "ComponentInstanceNode": | ||
| icon = ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="11" | ||
|
madebyisaacr marked this conversation as resolved.
|
||
| height="11" | ||
| viewBox="0 0 11 11" | ||
| className="component-icon" | ||
| > | ||
| <path | ||
| d="M4.44.55a1.5 1.5 0 0 1 2.12 0l1.592 1.591L5.5 4.793 2.848 2.14ZM2.14 8.152.551 6.56a1.5 1.5 0 0 1 0-2.122l1.59-1.59L4.793 5.5Zm8.309-3.713a1.5 1.5 0 0 1 0 2.122L8.859 8.15 6.207 5.5 8.86 2.848Zm-3.89 6.01a1.5 1.5 0 0 1-2.12 0L2.847 8.86 5.5 6.207 8.152 8.86Z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| ) | ||
| break | ||
|
|
||
| default: | ||
| icon = null | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <div className="icon" style={{ width, height }}> | ||
| {icon} | ||
| </div> | ||
| ) | ||
| return <div className="icon">{icon}</div> | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| export default function SearchIcon() { | ||
| return ( | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="11.384" height="11.134"> | ||
| <svg role="img" xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12"> | ||
| <path | ||
| d="M 5 0 C 7.761 0 10 2.239 10 5 C 10 6.046 9.679 7.017 9.13 7.819 L 11.164 9.854 C 11.457 10.146 11.457 10.621 11.164 10.914 C 10.871 11.207 10.396 11.207 10.104 10.914 L 8.107 8.918 C 7.254 9.595 6.174 10 5 10 C 2.239 10 0 7.761 0 5 C 0 2.239 2.239 0 5 0 Z M 1.5 5 C 1.5 6.933 3.067 8.5 5 8.5 C 6.933 8.5 8.5 6.933 8.5 5 C 8.5 3.067 6.933 1.5 5 1.5 C 3.067 1.5 1.5 3.067 1.5 5 Z" | ||
| d="M5.299.5a5 5 0 0 1 4.416 7.345.75.75 0 0 0 .127.887l1.621 1.622a.749.749 0 1 1-1.06 1.06L8.851 9.862a.75.75 0 0 0-.925-.107A5.001 5.001 0 1 1 5.299.5m-3.5 5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0" | ||
| fill="currentColor" | ||
| ></path> | ||
| /> | ||
| </svg> | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an alternative for the tabs could be to use this pattern instead, so that the new classes apply when
data-framer-stylesis set in the rootThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to using a selector for tab styles.