-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mobile-first): fix mobile-first components bugs (#1426)
- Loading branch information
Showing
605 changed files
with
11,117 additions
and
5,517 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
export const apis = import.meta.glob('../../../sites/demos/apis/*.js', { eager: false }) | ||
|
||
export const getPath = (path) => { | ||
if (path.startsWith('grid-')) { | ||
return 'grid' | ||
} else if (path.startsWith('chart-')) { | ||
return 'chart' | ||
} | ||
return path | ||
} | ||
|
||
export const getApisConfig = async (component, mode) => { | ||
const apisModule = apis[`../../../sites/demos/apis/${component}.js`] | ||
if (apisModule) { | ||
const apisConfig = (await apisModule()).default | ||
const demoKey = mode === 'mobile-first' ? 'mfDemo' : `${mode}Demo` | ||
const apis = apisConfig.apis.map((item) => { | ||
Object.keys(item).forEach((key) => { | ||
const apiItem = item[key] | ||
if (Array.isArray(apiItem)) { | ||
item[key] = apiItem | ||
.filter((i) => !i.mode || i.mode.includes(mode)) | ||
.map((filterItem) => ({ ...filterItem, demoId: filterItem[demoKey] })) | ||
} | ||
}) | ||
return item | ||
}) | ||
return { ...apisConfig, apis } | ||
} | ||
return {} | ||
} | ||
|
||
export const getDemosConfig = async (module) => { | ||
if (module) { | ||
const demosModule = await module() | ||
const demosConfig = demosModule.default | ||
return demosConfig | ||
} | ||
return { demos: [] } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.