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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

added folder icons support #8

Merged

Conversation

Mirza-Glitch
Copy link

@Mirza-Glitch Mirza-Glitch commented Oct 15, 2023

Removed icons.json file, bcoz I was having some problems with it (maybe some json syntax error) so I wrote it again as fileIcons.json.

Added folderIcons.json file, which contains folder icon name with folders name. Also added folder icons in icons directory !

Created a utility function to generate css style as string in js. My way of creating styles for folder icons might look kinda messy, change the way if you have any better idea ! Also added bunch of not so useful comments for you, remove them once you test the plugin in your Acode app.

Also, you had some previous commits, where you modified icons.json file, added few new icons if I remember. You have to do that again now... Sorry for that 馃檪

@Mirza-Glitch Mirza-Glitch mentioned this pull request Oct 15, 2023
@sebastianjnuwu sebastianjnuwu merged commit 869cc66 into sebastianjnuwu:material-icons Oct 15, 2023
@sebastianjnuwu
Copy link
Owner

Removed icons.json file, bcoz I was having some problems with it (maybe some json syntax error) so I wrote it again as fileIcons.json.

Added folderIcons.json file, which contains folder icon name with folders name. Also added folder icons in icons directory !

Created a utility function to generate css style as string in js. My way of creating styles for folder icons might look kinda messy, change the way if you have any better idea ! Also added bunch of not so useful comments for you, remove them once you test the plugin in your Acode app.

Also, you had some previous commits, where you modified icons.json file, added few new icons if I remember. You have to do that again now... Sorry for that 馃檪

Thank you very much for your contribution, Stan's icon ahhh okay tomorrow I will post the new version in bad country it's late aiai

@Mirza-Glitch
Copy link
Author

Mirza-Glitch commented Oct 15, 2023

Oops, i forgot to explain you how it works.

Since we don't have any helper function to set folder icon, we need to expicitly add css styling in the head element, which will be later taken as styling for folder icons...

For file icons we had some helper function which allowed us to give custom class names to a file, and then style it. But for folder icons, we neither have a helper function nor a way to set custom class names.

We need to first get to parent element, for example .list.collapsible.hidden will select a list item. Then select the child element which is a div, and it contains some very important information, like what is the type of item (file/folder), and what is the name of the item. We can simply get it by data attributes like data-name for item name and data-type to know is it a dir or file. Now we have the information of item, so select the first child element, or .icon.folder in our case which holds the styling for folder icon. Simply set the css psuedo-selector styling. Remember to set content property as content: " " !important;. Setting that !important is really important (use it with background-url property too), else the styles won't work perfectly.

You'll probably understand more when you look at the code. Or maybe this is actually very simple to anyone who knows how to code...

I just felt like explaining all this here, so whoever comes here would understand how this works...

@sebastianjnuwu
Copy link
Owner

Oops, i forgot to explain you how it works.

Since we don't have any helper function to set folder icon, we need to expicitly add css styling in the head element, which will be later taken as styling for folder icons...

For file icons we had some helper function which allowed us to give custom class names to a file, and then style it. But for folder icons, we neither have a helper function nor a way to set custom class names.

We need to first get to parent element, for example .list.collapsible.hidden will select a list item. Then select the child element which is a div, and it contains some very important information, like what is the type of item (file/folder), and what is the name of the item. We can simply get it by data attributes like data-name for item name and data-type to know is it a dir or file. Now we have the information of item, so select the first child element, or .icon.folder in our case which holds the styling for folder icon. Simply set the css psuedo-selector styling. Remember to set content property as content: " " !important;. Setting that !important is really important (use it with background-url property too), else the styles won't work perfectly.

You'll probably understand more when you look at the code. Or maybe this is actually very simple to anyone who knows how to code...

I just felt like explaining all this here, so whoever comes here would understand how this works...

Great explanation, I think I'll learn it over time!

Copy link

@Hernandez93 Hernandez93 left a comment

Choose a reason for hiding this comment

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

Contrase帽a

@sebastianjnuwu
Copy link
Owner

Contrase帽a

?

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.

None yet

3 participants