popojargo commented on a change in pull request #1103: Customize style of the 
results list
URL: https://github.com/apache/couchdb-fauxton/pull/1103#discussion_r231275786
 
 

 ##########
 File path: app/addons/documents/index-results/reducers.js
 ##########
 @@ -61,9 +62,34 @@ const initialState = {
   }
 };
 
+function loadStyle() {
+  let style = app.utils.localStorageGet('fauxton:results_style');
+  if (!style) {
+    style = {
+      textOverflow: Constants.INDEX_RESULTS_STYLE.TEXT_OVERFLOW_TRUNCATED,
+      fontSize: Constants.INDEX_RESULTS_STYLE.FONT_SIZE_MEDIUM
+    };
+  }
+  return style;
+}
+
+function storeStyle(style) {
+  app.utils.localStorageSet('fauxton:results_style', style);
+}
+
 export default function resultsState(state = initialState, action) {
   switch (action.type) {
 
+    case ActionTypes.INDEX_RESULTS_SET_STYLE:
+      const newStyle = {
+        ...state.resultsStyle,
+        ...action.resultsStyle
+      };
+      storeStyle(newStyle);
+      return Object.assign({}, state, {
+        resultsStyle: newStyle
 
 Review comment:
   Why don't you use the spread operator here as well?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to