mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-18 11:51:28 +02:00
feat: Add drop cap pattern
This commit is contained in:
@@ -1,104 +0,0 @@
|
|||||||
export enum Pattern {
|
|
||||||
Accordion = 'Accordion',
|
|
||||||
ArrowButtons = 'Arrow buttons',
|
|
||||||
Avatar = 'Avatar',
|
|
||||||
AvatarList = 'Avatar list',
|
|
||||||
Badge = 'Badge',
|
|
||||||
Breadcrumb = 'Breadcrumb',
|
|
||||||
ButtonWithIcon = 'Button with icon',
|
|
||||||
Card = 'Card',
|
|
||||||
CardLayout = 'Card layout',
|
|
||||||
Centering = 'Centering',
|
|
||||||
Chip = 'Chip',
|
|
||||||
CircularNavigation = 'Circular navigation',
|
|
||||||
CloseButton = 'Close button',
|
|
||||||
ColorSwatch = 'Color swatch',
|
|
||||||
ConcaveCorners = 'Concave corners',
|
|
||||||
CookieBanner = 'Cookie banner',
|
|
||||||
CornerRibbon = 'Corner ribbon',
|
|
||||||
CurvedBackground = 'Curved background',
|
|
||||||
CustomCheckboxButton = 'Custom checkbox button',
|
|
||||||
CustomRadioButton = 'Custom radio button',
|
|
||||||
DiagonalSection = 'Diagonal section',
|
|
||||||
DockedAtCorner = 'Docked at corner',
|
|
||||||
DotLeader = 'Dot leader',
|
|
||||||
DotNavigation = 'Dot navigation',
|
|
||||||
Drawer = 'Drawer',
|
|
||||||
DropArea = 'Drop area',
|
|
||||||
DropCap = 'Drop cap',
|
|
||||||
Dropdown = 'Dropdown',
|
|
||||||
FadingLongSection = 'Fading long section',
|
|
||||||
FeatureComparison = 'Feature comparison',
|
|
||||||
FeatureList = 'Feature list',
|
|
||||||
FixedAtCorner = 'Fixed at corner',
|
|
||||||
FixedAtSide = 'Fixed at side',
|
|
||||||
FloatingLabel = 'Floating label',
|
|
||||||
FolderStructure = 'Folder structure',
|
|
||||||
FullBackground = 'Full background',
|
|
||||||
FullScreenMenu = 'Full screen menu',
|
|
||||||
HolyGrail = 'Holy grail',
|
|
||||||
InitialAvatar = 'Initial avatar',
|
|
||||||
InputAddon = 'Input addon',
|
|
||||||
InvertedCorners = 'Inverted corners',
|
|
||||||
KeyboardShortcut = 'Keyboard shortcut',
|
|
||||||
LayeredCard = 'Layered card',
|
|
||||||
LinedPaper = 'Lined paper',
|
|
||||||
MasonryGrid = 'Masonry grid',
|
|
||||||
MediaObject = 'Media object',
|
|
||||||
MegaMenu = 'Mega menu',
|
|
||||||
Menu = 'Menu',
|
|
||||||
Modal = 'Modal',
|
|
||||||
NestedDropdowns = 'Nested dropdowns',
|
|
||||||
Notification = 'Notification',
|
|
||||||
OverlayPlayButton = 'Overlay play button',
|
|
||||||
Pagination = 'Pagination',
|
|
||||||
PopoverArrow = 'Popover arrow',
|
|
||||||
PresenceIndicator = 'Presence indicator',
|
|
||||||
PreviousNextButtons = 'Previous next buttons',
|
|
||||||
PricingTable = 'Pricing table',
|
|
||||||
PriceTag = 'Price tag',
|
|
||||||
PropertyList = 'Property list',
|
|
||||||
ProgressBar = 'Progress bar',
|
|
||||||
QuestionsAndAnswers = 'Questions and answers',
|
|
||||||
RadialProgressBar = 'Radial progress bar',
|
|
||||||
RadioButtonGroup = 'Radio button group',
|
|
||||||
RadioSwitch = 'Radio switch',
|
|
||||||
Rating = 'Rating',
|
|
||||||
ResizableElement = 'Resizable element',
|
|
||||||
Ribbon = 'Ribbon',
|
|
||||||
SameHeightColumns = 'Same height columns',
|
|
||||||
SearchBox = 'Search box',
|
|
||||||
Separator = 'Separator',
|
|
||||||
Sidebar = 'Sidebar',
|
|
||||||
SimpleGrid = 'Simple grid',
|
|
||||||
Slider = 'Slider',
|
|
||||||
SpinButton = 'Spin button',
|
|
||||||
SplitNavigation = 'Split navigation',
|
|
||||||
SplitScreen = 'Split screen',
|
|
||||||
StackedCards = 'Stacked cards',
|
|
||||||
StampBorder = 'Stamp border',
|
|
||||||
Statistic = 'Statistic',
|
|
||||||
StatusLight = 'Status light',
|
|
||||||
StepperInput = 'Stepper input',
|
|
||||||
StickyFooter = 'Sticky footer',
|
|
||||||
StickyHeader = 'Sticky header',
|
|
||||||
StickySections = 'Sticky sections',
|
|
||||||
StickyTableColumn = 'Sticky table column',
|
|
||||||
StickyTableHeaders = 'Sticky table headers',
|
|
||||||
Switch = 'Switch',
|
|
||||||
Tab = 'Tab',
|
|
||||||
Teardrop = 'Teardrop',
|
|
||||||
ThreeDimensionsCard = 'Three dimensions card',
|
|
||||||
Timeline = 'Timeline',
|
|
||||||
TogglePasswordVisibility = 'Toggle password visibility',
|
|
||||||
Tooltip = 'Tooltip',
|
|
||||||
TreeDiagram = 'Tree diagram',
|
|
||||||
TriangleButtons = 'Triangle buttons',
|
|
||||||
UploadButton = 'Upload button',
|
|
||||||
ValidationIcon = 'Validation icon',
|
|
||||||
VideoBackground = 'Video background',
|
|
||||||
Voting = 'Voting',
|
|
||||||
Watermark = 'Watermark',
|
|
||||||
Wizard = 'Wizard',
|
|
||||||
ZigzagTimeline = 'Zigzag timeline',
|
|
||||||
}
|
|
3
contents/_includes/patterns/drop-cap.njk
Normal file
3
contents/_includes/patterns/drop-cap.njk
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="drop-cap">
|
||||||
|
CSS is a style sheet language used for describing the presentation of a document written in a markup language like HTML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.
|
||||||
|
</div>
|
37
contents/drop-cap.md
Normal file
37
contents/drop-cap.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
layout: layouts/post.njk
|
||||||
|
title: Drop cap
|
||||||
|
description: Create a drop cap with CSS
|
||||||
|
keywords: css drop cap, css :first-letter
|
||||||
|
---
|
||||||
|
|
||||||
|
## HTML
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div class="drop-cap">
|
||||||
|
...
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
## CSS
|
||||||
|
|
||||||
|
```css
|
||||||
|
.drop-cap:first-letter {
|
||||||
|
/* Display at the left */
|
||||||
|
float: left;
|
||||||
|
line-height: 1;
|
||||||
|
|
||||||
|
/* Spacing */
|
||||||
|
margin: 0 0.5rem 0 0;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
|
||||||
|
/* Optional */
|
||||||
|
border: 2px solid rgba(0, 0, 0, .3);
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% demo %}
|
||||||
|
{% include "patterns/drop-cap.njk" %}
|
||||||
|
{% enddemo %}
|
@@ -115,6 +115,12 @@ eleventyExcludeFromCollections: true
|
|||||||
<div class="pattern__title">Drop area</div>
|
<div class="pattern__title">Drop area</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pattern__item">
|
||||||
|
<a class="pattern__link" href="/drop-cap/">
|
||||||
|
<div class="pattern__cover">{% include "patterns/drop-cap.njk" %}</div>
|
||||||
|
<div class="pattern__title">Drop cap</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -1,63 +0,0 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import Head from 'next/head';
|
|
||||||
|
|
||||||
import { PatternLayout } from '../../layouts/PatternLayout';
|
|
||||||
import BrowserFrame from '../../placeholders/BrowserFrame';
|
|
||||||
import { Pattern } from '../../constants/Pattern';
|
|
||||||
|
|
||||||
const Details: React.FC<{}> = () => {
|
|
||||||
return (
|
|
||||||
<PatternLayout pattern={Pattern.DropCap}>
|
|
||||||
<Head>
|
|
||||||
<meta name="description" content="Create a drop cap with CSS" />
|
|
||||||
<meta name="og:description" content="Create a drop cap with CSS" />
|
|
||||||
<meta name="twitter:description" content="Create a drop cap with CSS" />
|
|
||||||
<meta name="keywords" content="css drop cap" />
|
|
||||||
</Head>
|
|
||||||
<BrowserFrame
|
|
||||||
html={`
|
|
||||||
<div class="container">
|
|
||||||
...
|
|
||||||
</div>
|
|
||||||
`}
|
|
||||||
css={`
|
|
||||||
/* Styles for the first letter */
|
|
||||||
.container:first-letter {
|
|
||||||
/* Display at the left */
|
|
||||||
float: left;
|
|
||||||
line-height: 1;
|
|
||||||
|
|
||||||
/* Spacing */
|
|
||||||
margin: 0 8px 0 0;
|
|
||||||
padding: 0 8px;
|
|
||||||
|
|
||||||
/* Optional */
|
|
||||||
font-size: 64px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
alignItems: 'center',
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
height: '100%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
padding: '8px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div style={{ width: '256px' }}>
|
|
||||||
<div className="p-drop-cap">
|
|
||||||
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation
|
|
||||||
of a document written in a markup language like HTML. CSS is a cornerstone technology of the
|
|
||||||
World Wide Web, alongside HTML and JavaScript.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</BrowserFrame>
|
|
||||||
</PatternLayout>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Details;
|
|
@@ -1,79 +0,0 @@
|
|||||||
import * as React from 'react';
|
|
||||||
|
|
||||||
import Circle from '../../placeholders/Circle';
|
|
||||||
import Frame from '../../placeholders/Frame';
|
|
||||||
import Line from '../../placeholders/Line';
|
|
||||||
|
|
||||||
const Cover: React.FC<{}> = () => {
|
|
||||||
return (
|
|
||||||
<Frame>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
height: '100%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
padding: '8px',
|
|
||||||
width: '100%',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div style={{ display: 'flex', height: '32px', width: '100%' }}>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
alignItems: 'center',
|
|
||||||
border: '2px dashed rgba(0, 0, 0, 0.3)',
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'center',
|
|
||||||
marginRight: '8px',
|
|
||||||
width: '32px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Circle />
|
|
||||||
</div>
|
|
||||||
<div style={{ flex: 1 }}>
|
|
||||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '80%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '60%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '80%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '40%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style={{ marginTop: '4px' }}>
|
|
||||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '80%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '40%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
<div style={{ marginBottom: '4px', width: '60%' }}>
|
|
||||||
<Line />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Frame>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Cover;
|
|
@@ -7,8 +7,6 @@
|
|||||||
}
|
}
|
||||||
.pattern__link {
|
.pattern__link {
|
||||||
color: #6366f1;
|
color: #6366f1;
|
||||||
font-size: 1.25rem;
|
|
||||||
font-weight: 500;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@@ -23,3 +21,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
.pattern__title {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
@@ -28,6 +28,7 @@
|
|||||||
@import './patterns/docked-at-corner';
|
@import './patterns/docked-at-corner';
|
||||||
@import './patterns/dot-leader';
|
@import './patterns/dot-leader';
|
||||||
@import './patterns/drop-area';
|
@import './patterns/drop-area';
|
||||||
|
@import './patterns/drop-cap';
|
||||||
|
|
||||||
// Placeholders
|
// Placeholders
|
||||||
@import './placeholders/circle';
|
@import './placeholders/circle';
|
||||||
|
18
styles/patterns/_drop-cap.scss
Normal file
18
styles/patterns/_drop-cap.scss
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
.drop-cap {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.drop-cap:first-letter {
|
||||||
|
border: 2px solid rgba(0, 0, 0, .3);
|
||||||
|
|
||||||
|
/* Display at the left */
|
||||||
|
float: left;
|
||||||
|
line-height: 1;
|
||||||
|
|
||||||
|
/* Spacing */
|
||||||
|
margin: 0 0.5rem 0 0;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
|
||||||
|
/* Optional */
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
Reference in New Issue
Block a user