Skip to content

Commit

Permalink
Merge pull request klembot#995 from klembot/route-toolbar
Browse files Browse the repository at this point in the history
Change top toolbar to tabs, make all cards selectable
  • Loading branch information
klembot authored Jan 2, 2022
2 parents a29f478 + 0cddfde commit 1deaeaa
Show file tree
Hide file tree
Showing 201 changed files with 4,867 additions and 2,706 deletions.
29 changes: 26 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@popperjs/core": "^2.9.1",
"@tabler/icons": "^1.40.2",
"@tabler/icons": "^1.48.0",
"classnames": "^2.2.6",
"codemirror": "^5.59.4",
"detect-it": "^4.0.1",
Expand All @@ -35,6 +35,7 @@
"react-popper": "^2.2.4",
"react-router-dom": "^5.2.0",
"react-scrollbar-size": "^3.2.0",
"react-tabs": "^3.2.3",
"react-transition-group": "^4.4.1",
"scroll": "^3.0.1",
"segseg": "^1.0.0",
Expand Down Expand Up @@ -68,6 +69,7 @@
"@types/react-dom": "^16.9.0",
"@types/react-helmet": "^6.1.1",
"@types/react-router-dom": "^5.1.7",
"@types/react-tabs": "^2.3.3",
"@types/react-transition-group": "^4.4.1",
"@types/scroll": "^3.0.0",
"@types/semver": "^7.3.4",
Expand Down
126 changes: 78 additions & 48 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@
"common": {
"add": "Add",
"appName": "Twine",
"back": "Back",
"build": "Build",
"cancel": "Cancel",
"close": "Close",
"color": "Color",
"custom": "Custom",
"delete": "Delete",
"deleteCount": "Delete ({{count}})",
"details": "Details",
"duplicate": "Duplicate",
"edit": "Edit",
"editCount": "Edit ({{count}})",
"help": "Help",
"import": "Import",
"more": "More",
"new": "New",
"next": "Next",
"ok": "OK",
"passage": "Passage",
"play": "Play",
"preferences": "Preferences",
"publishToFile": "Publish To File",
Expand All @@ -32,21 +38,18 @@
"rename": "Rename",
"renamePrompt": "What should “{{name}}” be renamed to?",
"remove": "Remove",
"selectAll": "Select All",
"skip": "Skip",
"story": "Story",
"storyFormat": "Story Format",
"tag": "Tag",
"test": "Test",
"twine": "Twine",
"undo": "Undo",
"undoChange": "Undo {{change}}"
"undoChange": "Undo {{change}}",
"view": "View"
},
"components": {
"addStoryFormatButton": {
"addPreview": "{{storyFormatName}} {{storyFormatVersion}} will be added.",
"alreadyAdded": "{{storyFormatName}} {{storyFormatVersion}} has already been added.",
"fetchError": "An error occurred while retrieving this format ({{errorMessage}}).",
"prompt": "To add a story format, enter its address below.",
"invalidUrl": "The address you've entered isn't a valid URL."
},
"addTagButton": {
"alreadyAdded": "This tag name has already been added.",
"addLabel": "Add Tag",
Expand Down Expand Up @@ -94,20 +97,20 @@
"message": "The browser you are using will delete all stories after seven days of not visiting this web site."
},
"storyCard": {
"deleteStoryWarning": {
"electron": "Are you sure you want to delete “{{storyName}}”? It will be moved to the trash.",
"web": "Are you sure you want to delete “{{storyName}}”? It will be deleted forever. This cannot be undone."
},
"lastUpdated": "Last edited on {{date}}",
"passageCount": "1 passage",
"passageCount_plural": "{{count}} passages"
},
"storyFormatCard": {
"author": "by {{author}}",
"builtIn": "Built In",
"defaultFormat": "Default",
"editorExtensionsDisabled": "Editor Extensions Disabled",
"license": "License: {{license}}",
"loadingFormat": "Loading this story format...",
"loadError": "This story format could not be loaded ({{errorMessage}}).",
"name": "{{name}} {{version}}",
"proofing": "Proofing",
"useEditorExtensions": "Use Editor Extensions",
"useFormat": "Use As Default Story Format",
"useProofingFormat": "Use As Proofing Format"
Expand Down Expand Up @@ -164,8 +167,18 @@
"noTags": "No tags have been added to passages in this story.",
"title": "Passage Tags"
},
"storyInfo": {
"setStoryFormat": "Set Story Format",
"storyImport": {
"deselectAll": "Deselect All",
"filePrompt": "To import stories into Twine, upload either an archive or published story file below.",
"importDifferentFile": "Import a Different File",
"importSelected": "Import Selected Files",
"importThisStory": "Import This Story",
"noStoriesInFile": "There don't appear to be any Twine stories in the file you uploaded. Please choose another file.",
"storiesPrompt": "Choose which stories to import:",
"title": "Import Stories",
"willReplaceExisting": "A story with the same name in your library will be replaced."
},
"storyDetails": {
"storyFormatExplanation": "What's a story format?",
"snapToGrid": "Snap To Grid",
"stats": {
Expand All @@ -183,7 +196,7 @@
"storyJavaScript": {
"editorLabel": "Story JavaScript",
"title": "Story JavaScript",
"explanation": "Any JavaScript entered here will immediately run when your story is opened in a Web browser."
"explanation": "JavaScript entered here will immediately run when your story is opened in a Web browser."
},
"storySearch": {
"title": "Find and Replace",
Expand All @@ -200,7 +213,7 @@
"storyStylesheet": {
"editorLabel": "Story Stylesheet",
"title": "Story Stylesheet",
"explanation": "Any CSS entered here will override the default appearance of your story."
"explanation": "CSS entered here will override the default appearance of your story."
},
"storyTags": {
"noTags": "No tags have been added to your stories.",
Expand Down Expand Up @@ -234,19 +247,26 @@
},
"routes": {
"storyEdit": {
"toolbar": {
"findAndReplace": "Find and Replace",
"javaScript": "JavaScript",
"passageTags": "Passage Tags",
"snapToGrid": "Snap to Grid",
"startStoryHere": "Start Story Here",
"stylesheet": "Stylesheet",
"testFromHere": "Test From Here"
},
"topBar": {
"addPassage": "Passage",
"editJavaScript": "Edit Story JavaScript",
"editStylesheet": "Edit Story Stylesheet",
"findAndReplace": "Find and Replace",
"passageTags": "Edit Passage Tags",
"proofStory": "View Proofing Copy",
"publishToFile": "Publish to File",
"selectAllPassages": "Select All Passages",
"storyInfo": "Story Information",
"zoomIn": "Zoom In",
"zoomOut": "Zoom Out"
}
"selectAllPassages": "Select All Passages"
},
"zoomIn": "Zoom In",
"zoomOut": "Zoom Out"
},
"storyFormatList": {
"noneVisible": "No story formats match the criteria you've selected.",
Expand All @@ -256,21 +276,16 @@
"current": "Current Story Formats",
"user": "User-Added Story Formats"
},
"toolbar": {
"disableFormatExtensions": "Disable Editor Extensions",
"enableFormatExtensions": "Enable Editor Extensions",
"useAsDefaultFormat": "Use as Default Format",
"useAsProofingFormat": "Use to Proof Stories"
},
"storyFormatExplanation": "Story formats control the appearance and behavior of stories during play."
},
"storyImport": {
"choosePrompt": "Choose which stories to import from the file you uploaded:",
"deselectAll": "Deselect All",
"importDifferentFile": "Import a Different File",
"importSelected": "Import Selected Files",
"importThisStory": "Import This Story",
"noStoriesInFile": "There don't appear to be any Twine stories in the file you uploaded. Please choose another file.",
"selectAll": "Select All",
"title": "Import Stories",
"uploadPrompt": "To import stories into Twine, upload either an archive or published story file below.",
"willReplaceExisting": "A story with the same name in your library will be replaced."
},
"storyList": {
"library": "Library",
"noStories": "There are no stories saved in Twine right now. To get started, you can either create a new story or import an existing one from a file.",
"taggedTitleCount": "1 Tagged Story",
"taggedTitleCount_0": "No Tagged Stories",
Expand All @@ -279,19 +294,20 @@
"titleCount_0": "No Stories",
"titleCount_plural": "{{count}} Stories",
"titleGeneric": "Stories",
"topBar": {
"about": "About Twine",
"toolbar": {
"archive": "Archive",
"createStory": "Story",
"showAllStories": "All Stories",
"showTags": "Show Tags...",
"help": "Help",
"reportBug": "Report a Bug",
"sort": "Sort By...",
"sortDate": "Date",
"sortName": "Name",
"storyTags": "Edit Story Tags",
"storyFormats": "Formats"
"deleteStoryButton": {
"warning": {
"electron": "Are you sure you want to delete “{{storyName}}”? It will be moved to the trash.",
"web": "Are you sure you want to delete “{{storyName}}”? It will be deleted forever. This cannot be undone."
}
},
"showAllStories": "Show All Stories",
"showTags": "Show Tags",
"sort": "Sort By",
"sortByDate": "Last Updated",
"sortByName": "Name",
"storyTags": "Story Tags"
}
},
"welcome": {
Expand All @@ -309,6 +325,20 @@
"helpTitle": "New here?"
}
},
"routeActions": {
"app": {
"aboutApp": "About Twine",
"preferences": "Preferences",
"reportBug": "Report a Bug",
"storyFormats": "Story Formats"
},
"build": {
"play": "Play",
"proof": "Proof",
"publishToFile": "Publish to File",
"test": "Test"
}
},
"store": {
"archiveFilename": "{{timestamp}} Twine Archive.html",
"errors": {
Expand All @@ -332,12 +362,12 @@
},
"undoChange": {
"changeTagColor": "Change Tag Color",
"createPassage": "Create Passage",
"newPassage": "New Passage",
"deletePassage": "Delete Passage",
"deletePassages": "Delete Passages",
"movePassage": "Move Passage",
"movePassages": "Move Passages",
"removeTag": "Remove Tag",
"imortTag": "Remove Tag",
"renamePassage": "Rename Passage",
"renameTag": "Rename Tag",
"replaceAllText": "Replace All"
Expand Down
21 changes: 21 additions & 0 deletions src/components/badge/__tests__/badge.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {render, screen} from '@testing-library/react';
import {axe} from 'jest-axe';
import * as React from 'react';
import {Badge} from '../badge';

describe('<Badge>', () => {
function renderComponent() {
return render(<Badge label="mock-label" />);
}

it('displays its label', () => {
renderComponent();
expect(screen.getByText('mock-label')).toBeInTheDocument();
});

it('is accessible', async () => {
const {container} = renderComponent();

expect(await axe(container)).toHaveNoViolations();
});
});
14 changes: 14 additions & 0 deletions src/components/badge/badge.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@import '../../styles/colors.css';
@import '../../styles/depth.css';
@import '../../styles/metrics.css';

.badge {
align-items: center;
background-color: var(--off-white);
box-shadow: 0 1px 1px var(--light-gray);
border-radius: var(--control-height);
display: inline-flex;
height: var(--control-height);
font-size: 85%;
padding: var(--control-inner-padding) calc(2 * var(--control-inner-padding));
}
10 changes: 10 additions & 0 deletions src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react';
import './badge.css';

export interface BadgeProps {
label: string;
}

export const Badge: React.FC<BadgeProps> = ({label}) => (
<span className="badge">{label}</span>
);
Loading

0 comments on commit 1deaeaa

Please sign in to comment.