Skip to content

Commit

Permalink
fix(sketch): update shared color names to include space (#5664)
Browse files Browse the repository at this point in the history
* fix(sketch): update shared color names to include space

* fix(sketch): update generate page command
  • Loading branch information
joshblack authored and Alessandra Davila committed Mar 25, 2020
1 parent 39e6125 commit a2a96d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 2 additions & 5 deletions packages/sketch/src/commands/colors/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function generate() {
sharedStyles,
sharedStyle => {
const { name } = sharedStyle;
const [_category, swatch] = name.split('/');
const [_category, swatch] = name.split(' / ');
switch (swatch) {
case 'black':
return 'black';
Expand Down Expand Up @@ -74,9 +74,6 @@ export function generate() {
}

function createArtboardFromSharedStyle(sharedStyle, parent, offsetX, offsetY) {
const [category, swatch, grade] = sharedStyle.name.split('/');

const colorName = grade ? `${swatch}/${swatch}-${grade}` : swatch;
const rectangle = new ShapePath({
name: 'Color',
frame: new Rectangle(0, 0, ARTBOARD_WIDTH, ARTBOARD_HEIGHT),
Expand All @@ -91,7 +88,7 @@ function createArtboardFromSharedStyle(sharedStyle, parent, offsetX, offsetY) {

const artboard = new Artboard({
parent,
name: `${category}/${colorName}`,
name: sharedStyle.name,
frame: new Rectangle(offsetX, offsetY, ARTBOARD_WIDTH, ARTBOARD_HEIGHT),
layers: [rectangle],
});
Expand Down
4 changes: 3 additions & 1 deletion packages/sketch/src/sharedStyles/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,7 @@ export function syncColorStyles(document) {
* @returns {string}
*/
function formatSharedStyleName(name, grade) {
return ['color', name.split('-').join(' '), grade].filter(Boolean).join('/');
return ['color', name.split('-').join(' '), grade]
.filter(Boolean)
.join(' / ');
}

0 comments on commit a2a96d1

Please sign in to comment.