From 12ff6fe32a40d46f0caa156c94c5d36b26b3ca85 Mon Sep 17 00:00:00 2001 From: Stefanie Doll Date: Tue, 19 Feb 2019 16:18:19 +0100 Subject: [PATCH] Populate example name to input for custom examples (#731) * Set snippet name as default value in save input field * Onlu prefill input for custom examples --- packages/app-js/src/LocalStorage.tsx | 6 ++- packages/app-js/src/index.tsx | 55 ++++++++++++++-------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/packages/app-js/src/LocalStorage.tsx b/packages/app-js/src/LocalStorage.tsx index 5f7846df9e..2b3323f411 100644 --- a/packages/app-js/src/LocalStorage.tsx +++ b/packages/app-js/src/LocalStorage.tsx @@ -13,7 +13,8 @@ import translate from './translate'; type Props = BareProps & I18nProps & { isCustomExample: boolean, saveSnippet: (snippetName: string) => void, - removeSnippet: () => void + removeSnippet: () => void, + snippetName?: string }; type State = { @@ -75,6 +76,7 @@ class LocalStorage extends React.PureComponent { maxLength={50} min={1} placeholder={t('Name your example')} + value={snippetName} />