Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/lucide-icons/lucide into im…
Browse files Browse the repository at this point in the history
…plement-deprecate-comment
  • Loading branch information
ericfennis committed Dec 28, 2023
2 parents 4db0fff + f0422f4 commit ee5ccb7
Show file tree
Hide file tree
Showing 92 changed files with 1,038 additions and 317 deletions.
2 changes: 1 addition & 1 deletion categories/files.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../category.schema.json",
"title": "File icons",
"icon": "layout"
"icon": "panels-top-left"
}
2 changes: 1 addition & 1 deletion categories/layout.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../category.schema.json",
"title": "Layout",
"icon": "layout"
"icon": "panels-top-left"
}
46 changes: 34 additions & 12 deletions docs/.vitepress/lib/SvgPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,40 @@ const Radii = ({
>) => {
return (
<g className="svg-preview-radii-group" {...props}>
{paths
.filter(({ circle }) => circle)
.map(({ c, prev, next, circle: { x, y, r } }) =>
c.name === 'circle' ? (
<path d={`M${x} ${y}h.01`} />
) : (
<>
<path d={`M${prev.x} ${prev.y} ${x} ${y} ${next.x} ${next.y}`} />
<circle cy={y} cx={x} r={r} />
</>
)
)}
{paths.map(
({ c, prev, next, circle }, i) =>
circle && (
<React.Fragment key={i}>
{c.name !== "circle" && (
<path
d={`M${prev.x} ${prev.y} ${circle.x} ${circle.y} ${next.x} ${next.y}`}
/>
)}
<circle
cy={circle.y}
cx={circle.x}
r={0.25}
strokeDasharray="0"
stroke={
(Math.round(circle.x * 100) / 100) % 1 !== 0 ||
(Math.round(circle.y * 100) / 100) % 1 !== 0
? "red"
: undefined
}
/>
<circle
cy={circle.y}
cx={circle.x}
r={circle.r}
stroke={
(Math.round(circle.r * 1000) / 1000) % 1 !== 0
? "red"
: undefined
}
/>
</React.Fragment>
),
)}
</g>
);
};
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/lib/SvgPreview/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const getPaths = (src: string) => {
y2: c.y2,
})}`,
{
cp1: reflectedCp1,
cp1: { x: prev.x - reflectedCp1.x, y: prev.y - reflectedCp1.y },
cp2: { x: c.x2, y: c.y2 },
}
);
Expand Down
56 changes: 29 additions & 27 deletions docs/.vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,35 @@ const sidebar: UserConfig<DefaultTheme.Config>['themeConfig']['sidebar'] = {
]
},
// TODO: Add this section
// {
// text: 'Advanced',
// items: [
// {
// text: 'Accessibility',
// link: '/guide/advanced/accessibility'
// },
// {
// text: 'Global styling',
// },
// {
// text: 'Animations',
// },
// {
// text: 'Filled icons',
// },
// {
// text: 'Combining icons',
// },
// {
// text: 'Dynamic imports'
// },
// // {
// // text: 'Auto importing'
// // },
// ]
// },
{
text: 'Advanced',
items: [
// {
// text: 'Accessibility',
// link: '/guide/advanced/accessibility'
// },
{
text: 'Global styling',
link: '/guide/advanced/global-styling'
},
// {
// text: 'Animations',
// },
{
text: 'Filled icons',
link: '/guide/advanced/filled-icons'
},
// {
// text: 'Combining icons',
// },
// {
// text: 'Dynamic imports'
// },
// {
// text: 'Auto importing'
// },
]
},
{
text: 'Packages',
items: [
Expand Down
2 changes: 0 additions & 2 deletions docs/.vitepress/theme/components/packages/PackageListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ const props = defineProps<{
:href="packageData.documentation"
text="Guide"
theme="brand"
@click="go(packageData.documentation)"
/>
<VPButton
:href="packageData.source"
text="Source"
theme="alt"
@click="go(packageData.source)"
/>
</footer>
</Card>
Expand Down
4 changes: 4 additions & 0 deletions docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ html:has(* .outline-link:target) {
scroll-behavior: smooth;
} */

.sp-wrapper + * {
margin-top: 24px;
}

.sp-wrapper .sp-layout {
border-radius: 8px;
}
Expand Down
23 changes: 23 additions & 0 deletions docs/guide/advanced/examples/filled-icon-example/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Star, StarHalf } from "lucide-react";
import "./icon.css";

function App() {
return (
<div className="app">
<div className="star-rating">
<div className="stars">
{ Array.from({ length: 5 }, () => (
<Star fill="#111" strokeWidth={0} />
))}
</div>
<div className="stars rating">
<Star fill="yellow" strokeWidth={0} />
<Star fill="yellow" strokeWidth={0} />
<StarHalf fill="yellow" strokeWidth={0} />
</div>
</div>
</div>
);
}

export default App;
20 changes: 20 additions & 0 deletions docs/guide/advanced/examples/filled-icon-example/files.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import App from './App.js?raw'
import styles from '../../../basics/examples/styles.css?raw'
import IconCss from './icon.css?raw'

const files = {
'App.js': {
code: App,
active: true,
},
'icon.css': {
code: IconCss,
readOnly: false,
},
'styles.css': {
code: styles,
hidden: true
},
}

export default files
14 changes: 14 additions & 0 deletions docs/guide/advanced/examples/filled-icon-example/icon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.star-rating {
position: relative;
}

.stars {
display: flex;
gap: 4px;
}

.rating {
position: absolute;
top: 0;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
TentTree,
Caravan,
FlameKindling,
MountainSnow,
Trees,
Axe,
Map,
CloudMoon,
Sparkles,
} from "lucide-react";
import "./icon.css";

function App() {
return (
<div className="app">
<TentTree />
<Caravan />
<FlameKindling />
<MountainSnow />
<Trees />
<Axe />
<Map />
<CloudMoon />
<Sparkles />
</div>
);
}

export default App;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import App from './App.js?raw'
import styles from '../../../basics/examples/styles.css?raw'
import IconCss from './icon.css?raw'

const files = {
'icon.css': {
code: IconCss,
readOnly: false,
active: true,
},
'App.js': {
code: App,
},
'styles.css': {
code:styles,
hidden: true
},
}

export default files
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.lucide {
width: 48px;
height: 48px;
stroke-width: 1.5;
}

.lucide * {
vector-effect: non-scaling-stroke;
}

.app {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr
gap: 6px;
}
30 changes: 30 additions & 0 deletions docs/guide/advanced/examples/global-styling-css-example/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
CakeSlice,
Candy,
Apple,
Cookie,
Martini,
IceCream2,
Sandwich,
Wine,
Dessert,
} from "lucide-react";
import "./icon.css";

function App() {
return (
<div className="app">
<CakeSlice />
<Candy />
<Apple />
<Cookie />
<Martini />
<IceCream2 />
<Sandwich />
<Wine />
<Dessert />
</div>
);
}

export default App;
20 changes: 20 additions & 0 deletions docs/guide/advanced/examples/global-styling-css-example/files.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import App from './App.js?raw'
import styles from '../../../basics/examples/styles.css?raw'
import IconCss from './icon.css?raw'

const files = {
'icon.css': {
code: IconCss,
readOnly: false,
active: true,
},
'App.js': {
code: App,
},
'styles.css': {
code:styles,
hidden: true
},
}

export default files
14 changes: 14 additions & 0 deletions docs/guide/advanced/examples/global-styling-css-example/icon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.lucide {
/* Change this! */
color: #ffadff;
width: 56px;
height: 56px;
stroke-width: 1px;
}

.app {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr
gap: 6px;
}
24 changes: 21 additions & 3 deletions docs/guide/advanced/filled-icons.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
<script setup>
import { Sandpack } from 'sandpack-vue3'
import sandpackTheme from '../../.vitepress/theme/sandpackTheme.json'
import sizeIconExample from './examples/filled-icon-example/files.ts'
</script>

# Filled Icons

Fills are officially not supported.
However, all SVG properties are available on all icons.
Fill can still be used and will work fine on certain icons.

Example with stars:

<!-- Code Example with stars -->
<Sandpack
template="react"
:theme="sandpackTheme"
:files="sizeIconExample"
:customSetup='{
dependencies: {
"lucide-react": "latest"
}
}'
:options="{
editorHeight: 480,
editorWidthPercentage: 60,
}"
/>

## Will Lucide have fills in the future?

This feature is requested several times and discussion is happening at: [#458](https://github.com/lucide-icons/lucide/discussions/458).
This feature has been requested several times and discussion is happening at [#458](https://github.com/lucide-icons/lucide/discussions/458).
Loading

0 comments on commit ee5ccb7

Please sign in to comment.