-
Notifications
You must be signed in to change notification settings - Fork 975
Conversation
Nice! I tried it by pulling your repo, and I noticed some points.
Thanks! |
Thanks, I'm new to brave development so any suggestions to do this is appreciated! 😃 |
any update on the above? Also please rebase the commits to clean up history a bit to squash the commits |
Sorry for the delay (academic reasons), currently I'm working on it 😄
@luixxiul How much padding should I set ? 5px to 2px ? |
@dlion, I like the margin and padding of Also as @bbondy said please do not forget to run |
Currently I don't understand how to render the bookmarks bar after changing the option, any suggestions ? @luixxiul |
@dlion I downloaded your code locally, ran it, and see the issue When the preferences change, the items aren't recreated. I created a handler for this situation (my use case was having the menu show/auto hide, which requires changes to the BrowserWindow object). Please see here: |
Here's an example of where you can make the change: function handleChangeSettingAction (settingKey, settingValue) { switch (settingKey) { case settings.AUTO_HIDE_MENU: BrowserWindow.getAllWindows().forEach(function (wnd) { wnd.setAutoHideMenuBar(settingValue) wnd.setMenuBarVisibility(!settingValue) }) break case settings.SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: // TODO: recreate the BookmarksToolbar instance here, so it re-renders with the change break default: } } edit: |
@bsclifton in your situation you had to explicitly do it because state changes aren't propagated into electron actions. But in this case, and anything in React rendered UI, if the setting changes, it calls render on the component so no explicit action is necessary. You just have to handle the re-rendering. So trying to re-crete a BookmarksToolbar instance or any other React component isn't right. |
So if the @bsclifton solution isn't right, how can I re-render the bookmarksToolbar ? @bbondy |
If you change state then render will be called on BookmarkToolbar. You just need to define how to display the UI based on the state there. |
How's it going @dlion? Do you need help checking out this last item? |
Sure @bsclifton , I didn't figure out how to change the state of the bookmarksToolbar element in the appStore file. (I'm a newbie about React and Electron but I want to learn) |
Here we go @dlion, got it fixed and working 😄 I'm glad this came up because I also had the chance to clean up the code I did initially for the favicons Why does this work?main.js creates the BookmarkToolbar control. My change was to bind the settings to that control directly. Then in the child controls, it only checks it's property state. React triggers a re-render when any properties it's observing (used while rendering) change. So now changing the settings causes the full re-render. |
@dlion you might want to rebase against master... then you should be able to cherry pick my commit (please let me know if you have trouble doing that) Worst case scenario, you can just manually apply my changes in your branch 😄 |
Allows to hide the bookmarks label in the bookmarks toolbar - [x] Not applied to bookmarks in the folder - [x] Padding between bookmakrs should be narrower - [x] Render the bar when option change Close brave#1739
Thanks @bsclifton, I learned a lot! |
@dlion and @bsclifton, nice work! In the mode there should be |
@luixxiul I added the |
Thanks, I'm working on it too, wait for a moment. |
Allows to hide the bookmarks label in the bookmarks toolbar - [x] Not applied to bookmarks in the folder - [x] Padding between bookmakrs should be narrower - [x] Render the bar when option change Close brave#1739
@luixxiul great, committed and pushed! |
Allows to hide the bookmarks label in the bookmarks toolbar - [x] Not applied to bookmarks in the folder - [x] Padding between bookmakrs should be narrower - [x] Render the bar when option change Close brave#1657
ops, you are right, corrected! ⏩ |
tested it out, lgtm! Well done, @dlion 😄 |
Close #1657