Build out the basic Codex link component. Per T314332: Distribute design system styles as part of Codex, this component will be implemented as a LESS mixin that consumers can apply wherever necessary. Codex will not include any assumptions about class names to target for this style.
In addition to a mixin for the standard link styles, we will also create a mixin for "red link" styles intented only for use when linking non-existing pages in MediaWiki.
Live Preview
A live preview is visible here: https://829238--wikimedia-codex.netlify.app/sandbox/#cdx-link
Example Usage
In MediaWiki, or anywhere else that Less is available, users will be able to use the mixin like this:
@import ( reference ) '@wikimedia/codex/mixins/link.less'; a { .cdx-mixin-link-base(); &.is-red-link { .cdx-mixin-link-red(); } }
Development considerations
Since this component is being implemented in a way that differs from what we usually do, there are a couple of development questions that we should try to answer:
- How should we document this "component"? It would be great to list "Link" alongside the other components, but there is not a Link.vue file (only a Less mixin), so the automated docgen tool won't work here. Ideas for work-arounds? Currently this component is demonstrated in the Sandbox page only.
- How should we publish this mixin (as well as future mixins)? In the linked patch, I have added a simple Vite plugin that copies all mixins in a public sub-folder into dist/mixins. Less files are copied but not otherwise compiled, so we need to be sure to only reference variables from external packages (like the design tokens package). Will this work for users inside MediaWiki?
Design spec
Acceptance criteria (or Done)
- Design the Link component spec sheet and link Figma in the task
- Implement component in Codex
Design Review
(more details in this comment)
-
Add configurable demo to test the component propsAt the moment we can't implement configurable demos for all components - Red link focus should use border-color-progressive--focus since this red link it's not an error but a new page link
-
Start icon should be 20px size(this will be fixed in T322631) -
External link icon:(this will be fixed in T322631) - A 4px padding is needed between icon and text for end icon
-
Focus border is irregular when the link has end icon (external link icon)Acceptable browser behavior