Skip to content

Commit

Permalink
Remove need for lodash Command line interface to a user's defaults.
Browse files Browse the repository at this point in the history
Syntax:

'defaults' [-currentHost | -host <hostname>] followed by one of the following:

  read                                 shows all defaults
  read <domain>                        shows defaults for given domain
  read <domain> <key>                  shows defaults for given domain, key

  read-type <domain> <key>             shows the type for the given domain, key

  write <domain> <domain_rep>          writes domain (overwrites existing)
  write <domain> <key> <value>         writes key for domain

  rename <domain> <old_key> <new_key>  renames old_key to new_key

  delete <domain>                      deletes domain
  delete <domain> <key>                deletes key in domain

  import <domain> <path to plist>      writes the plist at path to domain
  import <domain> -                    writes a plist from stdin to domain
  export <domain> <path to plist>      saves domain as a binary plist to path
  export <domain> -                    writes domain as an xml plist to stdout
  domains                              lists all domains
  find <word>                          lists all entries containing word
  help                                 print this help

<domain> is ( <domain_name> | -app <application_name> | -globalDomain )
         or a path to a file omitting the '.plist' extension

<value> is one of:
  <value_rep>
  -string <string_value>
  -data <hex_digits>
  -int[eger] <integer_value>
  -float  <floating-point_value>
  -bool[ean] (true | false | yes | no)
  -date <date_rep>
  -array <value1> <value2> ...
  -array-add <value1> <value2> ...
  -dict <key1> <value1> <key2> <value2> ...
  -dict-add <key1> <value1> ...
  • Loading branch information
cee-chen committed Jul 25, 2022
1 parent b1128a8 commit 3c09f3f
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/components/token/token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import React, { FunctionComponent, HTMLAttributes } from 'react';
import classNames from 'classnames';
import defaults from 'lodash/defaults';
import { CommonProps } from '../common';
import { useEuiTheme, isColorDark, hexToRgb } from '../../services';

Expand Down Expand Up @@ -106,26 +105,16 @@ export const EuiToken: FunctionComponent<EuiTokenProps> = ({
finalSize = 'm';
}

const currentDisplay = {
color,
fill,
shape,
};

let finalDisplay;

// If the iconType passed is one of the prefab token types,
// grab its properties
if (typeof iconType === 'string' && iconType in TOKEN_MAP) {
const tokenDisplay = TOKEN_MAP[iconType as EuiTokenMapType];
finalDisplay = defaults(currentDisplay, tokenDisplay);
} else {
finalDisplay = currentDisplay;
}

const finalColor = finalDisplay.color || 'gray';
const finalShape = finalDisplay.shape || 'circle';
let finalFill = finalDisplay.fill || 'light';
const tokenDefaults =
typeof iconType === 'string' && iconType in TOKEN_MAP
? TOKEN_MAP[iconType as EuiTokenMapType]
: {};

const finalColor = color || tokenDefaults.color || 'gray';
const finalShape = shape || tokenDefaults.shape || 'circle';
let finalFill = fill || 'light';

const euiTheme = useEuiTheme();
const styles = euiTokenStyles(euiTheme);
Expand Down

0 comments on commit 3c09f3f

Please sign in to comment.