-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR updates element icons to the ones that product requested. This PR also consolidates the logic we used to decide what icon to render. SVGs sourced from https://fontawesome.com. <img width="370" alt="image" src="https://github.com/yext/studio/assets/59857107/bada0757-4267-4452-9869-714207e45101"> J-SLAP=2940 TEST=manual
- Loading branch information
Showing
15 changed files
with
62 additions
and
115 deletions.
There are no files selected for viewing
This file contains 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 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
8 changes: 5 additions & 3 deletions
8
packages/studio-ui/src/components/AddElementMenu/AddElementOption.tsx
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ReactComponent as Component } from "../../icons/square-solid.svg"; | ||
import { ReactComponent as Container } from "../../icons/square-empty.svg"; | ||
import { ReactComponent as Layout } from "../../icons/mosaic.svg"; | ||
import { ComponentMetadata } from "@yext/studio-plugin"; | ||
|
||
export enum ElementType { | ||
Components = "Components", | ||
Containers = "Containers", | ||
Layouts = "Layouts", | ||
} | ||
|
||
interface ElementIconProps { | ||
elementType: ElementType; | ||
} | ||
|
||
/** | ||
* Returns the Icon that represents the provided Element Type. | ||
*/ | ||
export default function ElementIcon(props: ElementIconProps) { | ||
switch (props.elementType) { | ||
case ElementType.Components: | ||
return <Component />; | ||
case ElementType.Containers: | ||
return <Container />; | ||
case ElementType.Layouts: | ||
return <Layout />; | ||
default: | ||
console.error(`Could not find Icon for type ${props.elementType}`); | ||
return null; | ||
} | ||
} | ||
|
||
export function getElementType(metadata: ComponentMetadata): ElementType { | ||
if (metadata.acceptsChildren) { | ||
return ElementType.Containers; | ||
} | ||
return ElementType.Components; | ||
} |
19 changes: 0 additions & 19 deletions
19
packages/studio-ui/src/components/common/renderIconForType.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.