Comments (6)
alternatively, another way of thinking of this is the .notdef
(aka. tofu) glyph in fonts...
https://docs.microsoft.com/en-us/typography/opentype/spec/recom#glyph-0-the-notdef-glyph
which is what normally gets displayed when a glyph requested isn't in the font
visually could be something like this:
pro of this would be if phosphor gets converted into (web) icon fonts as .notdef
is a required glyph (although sometimes left blank visually, so it looks like a space)
from homepage.
This is the way. Phosphor already has an icon font implementation, and we currently use a blank space for .notdef
, but this is much better and solves both problems.
from homepage.
Interesting idea. Personally I would spring for something simple like:
<svg xmlns="http://www.w3.org/2000/svg" height={size} width={size}></svg>
But I could see the need for a library solution for cases where you wanted to make use of Context or composition. Will definitely consider adding it. In the mean time, you can make your own, since we give you all the icon dependencies as public exports:
import React, { forwardRef, memo, useContext } from "react";
import { IconProps, IconContext } from "phosphor-react";
const EmptyIcon = memo(
forwardRef<SVGSVGElement, IconProps>((props, ref) => {
const { color, size, weight, mirrored, children, ...restProps } = props;
const {
color: contextColor,
size: contextSize,
weight: contextWeight,
mirrored: contextMirrored,
...restContext
} = useContext(IconContext);
return (
<svg
ref={ref}
xmlns="http://www.w3.org/2000/svg"
width={size ?? contextSize}
height={size ?? contextSize}
fill={color ?? contextColor}
viewBox="0 0 256 256"
transform={mirrored || contextMirrored ? "scale(-1, 1)" : undefined}
{...restContext}
{...restProps}
>
{children}
<rect width="256" height="256" fill="none" />
</svg>
);
})
);
export default EmptyIcon;
Here I included the Context and seemingly irrelevant props in the case you would want to do something conditionally with them, but you could leave them out.
from homepage.
A more minimal example that's still context and ref-aware:
import React, { forwardRef, memo, useContext } from "react";
import { IconProps, IconContext } from "phosphor-react";
const EmptyIcon = memo(
forwardRef<SVGSVGElement, IconProps>(({ size }, ref) => {
const { size: contextSize } = useContext(IconContext);
return (
<svg
ref={ref}
xmlns="http://www.w3.org/2000/svg"
width={size ?? contextSize}
height={size ?? contextSize}
fill="none"
/>
);
})
);
export default EmptyIcon;
from homepage.
I just realized I thought this issue was on the phosphor-react
library, and the example reflects that. But I guess the point still stands, it's an interesting idea but I'm not totally warm to including it yet.
from homepage.
placeholder
icon added in 1.2.0!
from homepage.
Related Issues (20)
- Icon request: disco HOT 1
- Icon Request: X (fka Twitter!) HOT 1
- Can the script be loaded using the `async` attribute? HOT 1
- Icon request: bomb
- All thin icons on EGUI are broken HOT 1
- Website is down HOT 2
- Icon request: reply HOT 2
- Website / Webpage Icon HOT 1
- icon request: support icon HOT 4
- Icons Request: money icons HOT 2
- New icon: file_ini
- New icon: file_txt
- Please add twitter new logo "X" HOT 1
- Requesting Qur'an and Mosque icons HOT 2
- Icon for polls/surveys HOT 1
- Icon for MapPinX or 'forbidden location'
- Icon for Mobile Off or Mobile Unsupported
- Requesting forex icon
- Bite
- newsletter icon HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homepage.