Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
add branding
Browse files Browse the repository at this point in the history
  • Loading branch information
tatimblin committed Nov 8, 2022
1 parent c27cd9f commit e27168d
Show file tree
Hide file tree
Showing 13 changed files with 33,991 additions and 14,771 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@yext/slapshot/typescript-react', 'plugin:storybook/recommended']
extends: ['@yext/eslint-config', 'plugin:storybook/recommended']
};
25 changes: 17 additions & 8 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
const path = require('path');
module.exports = {
"stories": [
stories: [
"../tests/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions"
"@storybook/addon-interactions",
'@storybook/addon-a11y',
{
name: '@storybook/addon-coverage',
options: {
istanbul: {
include: ['src/components/**']
}
}
},
],
"framework": {
"name": "@storybook/react-vite",
"options": {}
}
framework: "@storybook/react",
core: {
builder: "@storybook/builder-vite",
},
staticDirs: ['./public'],
}
1 change: 1 addition & 0 deletions .storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="icon" href="./yextIcon.svg">
5 changes: 5 additions & 0 deletions .storybook/manager.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { addons } = require('@storybook/addons');

addons.setConfig({
theme: require('./yextTheme.cjs')
});
14 changes: 14 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { runOnly } from './wcagConfig';

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
Expand All @@ -6,4 +8,16 @@ export const parameters = {
date: /Date$/,
},
},
a11y: {
options: {
runOnly
}
},
options: {
storySort: {
order: [
'Address'
],
},
},
}
Binary file added .storybook/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions .storybook/public/yextIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions .storybook/test-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { injectAxe, checkA11y } from 'axe-playwright';
import { Page } from 'playwright-core';
import { runOnly } from './wcagConfig';

/**
* See https://storybook.js.org/docs/react/writing-tests/test-runner#test-hook-api-experimental
* to learn more about the test-runner hooks API.
*/
const renderFunctions = {
async preRender(page: Page) {
await injectAxe(page);
},
async postRender(page: Page, context) {
await checkA11y(page, '#root', {
axeOptions: {
runOnly,
rules: {
'color-contrast': { enabled: context.name !== 'Loading' }
},
},
detailedReport: true,
detailedReportOptions: {
html: true,
},
});
},
};

export default renderFunctions;
6 changes: 6 additions & 0 deletions .storybook/wcagConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { axeOptionsConfig } from 'axe-playwright';

export const runOnly: axeOptionsConfig['axeOptions']['runOnly'] = {
type: 'tag',
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']
};
33 changes: 33 additions & 0 deletions .storybook/yextTheme.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

const { create } = require('@storybook/theming');

module.exports = create({
base: 'light',
colorPrimary: '#eeeff0',
colorSecondary: '#2563eb',

// UI
appBg: '#fafafa',
appContentBg: 'white',
appBorderColor: '#eeeff0',
appBorderRadius: 6,

// Text colors
textColor: 'black',
textMutedColor: '#4b5563',

// Toolbar colors
barTextColor: '#4b5563',
barBg: '#eeeff0',

// Form
inputBg: 'white',
inputTextColor: 'black',
inputBorder: '#9ca3af',
inputBorderRadius: 4,

// Brand logo
brandTitle: 'Yext Component Library',
brandUrl: 'https://github.com/yext/search-ui-react',
brandImage: './logo.png'
});
Loading

0 comments on commit e27168d

Please sign in to comment.