Skip to content

Commit

Permalink
chore(docs): fix the order of stories in the playground (#2645)
Browse files Browse the repository at this point in the history
* Change the story file name to include stories

When we move to version 7+, this will be updated to mgt-component.js from mgt-component.stories.js

Signed-off-by: Musale Martin <[email protected]>

* Order options to start with stories files

Signed-off-by: Musale Martin <[email protected]>

* Update pages that the theme toggle should not appear on

Signed-off-by: Musale Martin <[email protected]>

---------

Signed-off-by: Musale Martin <[email protected]>
  • Loading branch information
musale authored and gavinbarron committed Aug 21, 2023
1 parent e3628e5 commit e9a1d77
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 75 deletions.
5 changes: 3 additions & 2 deletions .storybook/addons/codeEditorAddon/codeAddon.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ export const withCodeEditor = makeDecorator({
skipIfNoParametersOrOptions: false,
wrapper: (getStory, context, { options }) => {
const forOptions = options ? options.disableThemeToggle : false;
const forContext =
context && (context.name === 'Custom CSS Properties' || context.title.toLowerCase().includes('templating'));
const title =
['Custom CSS Properties', 'Theme'].includes(context.name) || context.title.toLowerCase().includes('templating');
const forContext = context && title;
const disableThemeToggle = forOptions || forContext;
let story = getStory(context);

Expand Down
7 changes: 6 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ addParameters({
inlineStories: false,
page: noArgsDocsPage
},
version: versionInfo
version: versionInfo,
options: {
storySort: {
order: ['stories']
}
}
});

const req = require.context('../stories', true, /\.(js|mdx)$/);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
72 changes: 0 additions & 72 deletions stories/samples/general.stories.b.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,54 @@ clearCacheButton.addEventListener('click', onClearCacheButtonClick);
// };
</script>
`;

export const theme = () => html`
<div>
<p>This demonstrates how to set the theme globally without using a theme toggle and customize styling within specific scopes</p>
<p>Please refer to the JS and CSS tabs in the editor for implentation details</p>
<mgt-login></mgt-login>
<p>This picker shows the custom focus ring color</p>
<div class="custom-focus">
<mgt-people-picker></mgt-people-picker>
</div>
<article>
<p>I use the theme set on the body</p>
<mgt-teams-channel-picker></mgt-teams-channel-picker>
</article>
<p>I am custom themed, take care to ensure that your customizations maintain accessibility standards</p>
<mgt-teams-channel-picker class="custom1"></mgt-teams-channel-picker>
</div>
<script>
import { applyTheme } from '@microsoft/mgt';
const body = document.querySelector('body');
if(body) applyTheme('dark', body);
</script>
<style>
body {
background-color: var(--fill-color);
color: var(--neutral-foreground-rest);
font-family: var(--body-font);
}
.custom-focus {
--focus-ring-color: red;
--focus-ring-style: solid;
}
.custom1 {
--channel-picker-input-border: 2px solid teal;
--channel-picker-input-background-color: black;
--channel-picker-input-background-color-hover: #1a1a1a;
--channel-picker-search-icon-color: yellow;
--channel-picker-close-icon-color: yellow;
--channel-picker-down-chevron-color: yellow;
--channel-picker-up-chevron-color: yellow;
--channel-picker-input-placeholder-text-color: white;
--channel-picker-input-placeholder-text-color-focus: yellow;
--channel-picker-input-placeholder-text-color-hover: chartreuse;
--channel-picker-dropdown-background-color: #008383;
--channel-picker-dropdown-item-background-color-hover: #006363;
--channel-picker-font-color: white;
--channel-picker-placeholder-default-color: white;
--channel-picker-placeholder-focus-color: #441540;
}
</style>
`;

0 comments on commit e9a1d77

Please sign in to comment.