-
Notifications
You must be signed in to change notification settings - Fork 34
feat: version-compare-component #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Icemap
wants to merge
8
commits into
pingcap:master
Choose a base branch
from
Icemap:feat-version-compare-component
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4a31c95
feat: version-compare-component
b6b5ab9
feat: mdx components support context
shczhen 2863a10
feat: i18n and markdown link component
942ba77
feat: i18n and markdown link component
0c8613c
remove: useless output log
946a100
feat: wording and remove version type
3626eef
feat: new tag i18n
c5765d2
Delete src/components/MDXComponents/VersionVars.tsx
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,21 @@ | ||
import * as React from "react"; | ||
|
||
import { MdxContext } from "context/MdxContext"; | ||
import { Link } from "gatsby-plugin-react-i18next"; | ||
import { Locale } from "static/Type"; | ||
|
||
export function MDLink(props: { | ||
url: string; | ||
children?: any; | ||
}) { | ||
const mdxContextData = React.useContext(MdxContext); | ||
const { pathConfig } = mdxContextData; | ||
const {url} = props; | ||
const localeURL = pathConfig.locale === Locale.en ? "" : "/" + pathConfig.locale; | ||
const relativeURL = url.startsWith("/") ? url : "/" + url; | ||
const realURL = localeURL + "/" + pathConfig.repo + "/" + pathConfig.version + relativeURL; | ||
|
||
return ( | ||
<Link to={realURL}>{props.children}</Link> | ||
) | ||
} |
This file contains hidden or 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,60 @@ | ||
import * as React from "react"; | ||
import Stack from "@mui/material/Stack"; | ||
import Typography from "@mui/material/Typography"; | ||
import { Card, CardContent, Chip } from '@mui/material'; | ||
|
||
type ScopeType = "SESSION" | "GLOBAL" | "BOTH"; | ||
|
||
export function VersionVars(props: { | ||
name: string; | ||
scope: ScopeType; | ||
type: string; | ||
applyHint: boolean; | ||
defaultValue: string; | ||
involveVersion?: string; | ||
possibleValues?: string; | ||
range?: string; | ||
unit?: string; | ||
children?: any; | ||
}) { | ||
|
||
const INIT_VERSION = "v0.0.1" | ||
const { | ||
name = "", | ||
involveVersion = INIT_VERSION, | ||
scope = "GLOBAL", | ||
type = "", | ||
applyHint = false, | ||
defaultValue = "", | ||
children = [], | ||
possibleValues = "", | ||
range = "", | ||
unit = "", | ||
} = props; | ||
|
||
return ( | ||
<Card sx={{ minWidth: 275 }}> | ||
<CardContent> | ||
<Typography variant="h5" component="div"> {name} </Typography> | ||
<Typography sx={{ mb: 1.5 }} color="text.secondary"> | ||
{ involveVersion === INIT_VERSION ? "From the beginning" : "New in " + involveVersion } | ||
</Typography> | ||
<Stack direction="row" spacing={1}> | ||
{scope === "SESSION" || scope === "BOTH" ? <Chip label="SESSION" color="primary" /> : null} | ||
{scope === "GLOBAL" || scope === "BOTH" ? <Chip label="GLOBAL" color="success" /> : null} | ||
</Stack> | ||
|
||
<Typography> Type: {type} </Typography> | ||
<Typography> Applies to hint SET_VAR: {applyHint ? "Yes" : "No"} </Typography> | ||
<Typography> Default value: {defaultValue} </Typography> | ||
{range === "" ? "" : <Typography> Range: {range} </Typography>} | ||
{possibleValues === "" ? "" : <Typography> Possible values: {possibleValues} </Typography>} | ||
{unit === "" ? "" : <Typography> Unit: {unit} </Typography>} | ||
|
||
<Typography variant="body2"> | ||
{...children} | ||
</Typography> | ||
</CardContent> | ||
</Card> | ||
); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.