mirror of
https://github.com/tabler/tabler.git
synced 2025-12-21 17:34:25 +04:00
tabler components page
This commit is contained in:
@@ -40,6 +40,8 @@ collections:
|
|||||||
output: true
|
output: true
|
||||||
changelog:
|
changelog:
|
||||||
output: false
|
output: false
|
||||||
|
components:
|
||||||
|
output: true
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
-
|
-
|
||||||
@@ -54,6 +56,11 @@ defaults:
|
|||||||
values:
|
values:
|
||||||
layout: docs
|
layout: docs
|
||||||
nav-position: top
|
nav-position: top
|
||||||
|
-
|
||||||
|
scope:
|
||||||
|
type: components
|
||||||
|
values:
|
||||||
|
layout: component
|
||||||
|
|
||||||
|
|
||||||
colors:
|
colors:
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ bs.init({
|
|||||||
ignoreInitial: true,
|
ignoreInitial: true,
|
||||||
},
|
},
|
||||||
notify: false,
|
notify: false,
|
||||||
|
open: false
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Premium and Open Source dashboard template with responsive and high quality UI.",
|
"description": "Premium and Open Source dashboard template with responsive and high quality UI.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npm-run-all clean css-main js-compile-standalone --parallel browsersync watch html-watch",
|
"start": "npm-run-all clean css-main js-compile-standalone --parallel html-watch browsersync watch",
|
||||||
"build": "npm-run-all clean html-build css js fonts",
|
"build": "npm-run-all clean html-build css js fonts",
|
||||||
"bundlesize": "bundlesize",
|
"bundlesize": "bundlesize",
|
||||||
"browsersync": "node build/browsersync.js",
|
"browsersync": "node build/browsersync.js",
|
||||||
|
|||||||
5
pages/_components/simple-card.html
Normal file
5
pages/_components/simple-card.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
name: Simple box
|
||||||
|
---
|
||||||
|
|
||||||
|
{% include cards/card.html %}
|
||||||
5
pages/_components/widget-sales.html
Normal file
5
pages/_components/widget-sales.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: Sales widget
|
||||||
|
---
|
||||||
|
|
||||||
|
{% include cards/charts/sales.html %}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="card-status-{{include.status-position}} bg-{{ include.status-color | default: 'blue' }}"></div>
|
<div class="card-status-{{include.status-position}} bg-{{ include.status-color | default: 'blue' }}"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% unless include.hide-header %}
|
{% if include.show-header %}
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">{{ include.title | default: 'Card title' }}</h3>
|
<h3 class="card-title">{{ include.title | default: 'Card title' }}</h3>
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endunless %}
|
{% endunless %}
|
||||||
</div>
|
</div>
|
||||||
{% endunless %}
|
{% endif %}
|
||||||
|
|
||||||
{% if include.alert %}
|
{% if include.alert %}
|
||||||
<div class="card-alert alert alert-{{ include.alert-type | default: 'success' }} mb-0">
|
<div class="card-alert alert alert-{{ include.alert-type | default: 'success' }} mb-0">
|
||||||
|
|||||||
18
pages/_includes/cards/charts/sales.html
Normal file
18
pages/_includes/cards/charts/sales.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div>Sales</div>
|
||||||
|
<div class="ml-auto">
|
||||||
|
{% include parts/dropdown/days.html %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="h1 mb-3">75%</div>
|
||||||
|
<div class="d-flex mb-2">
|
||||||
|
<div>Conversion rate</div>
|
||||||
|
<div class="ml-auto text-green">
|
||||||
|
24% {% include ui/icon.html icon="trending-up" class="icon-thin" %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% include ui/progress.html percentage=75 color="blue" size="sm" %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,23 +1,6 @@
|
|||||||
<div class="row row-cards">
|
<div class="row row-cards">
|
||||||
<div class="col-sm-6 col-lg-3">
|
<div class="col-sm-6 col-lg-3">
|
||||||
<div class="card">
|
{% include cards/charts/sales.html %}
|
||||||
<div class="card-body">
|
|
||||||
<div class="d-flex">
|
|
||||||
<div>Sales</div>
|
|
||||||
<div class="ml-auto">
|
|
||||||
{% include parts/dropdown/days.html %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="h1 mb-3">75%</div>
|
|
||||||
<div class="d-flex mb-2">
|
|
||||||
<div>Conversion rate</div>
|
|
||||||
<div class="ml-auto text-green">
|
|
||||||
24% {% include ui/icon.html icon="trending-up" class="icon-thin" %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% include ui/progress.html percentage=75 color="blue" size="sm" %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6 col-lg-3">
|
<div class="col-sm-6 col-lg-3">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
|
|
||||||
{% assign provider = include.provider | default: "fe" %}<i class="icon {{ provider }} {{ provider }}-{{ include.icon }}{% if include.class %} {{ include.class }}{% endif %}{% if include.color %} text-{{ include.color }}{% endif %}"></i>
|
{% assign provider = include.provider | default: "fe" %}<i class="icon {{ provider }} {{ provider }}-{{ include.icon }}{% if include.class %} {{ include.class }}{% endif %}{% if include.color %} text-{{ include.color }}{% endif %}"></i>
|
||||||
|
|||||||
18
pages/_layouts/component.html
Normal file
18
pages/_layouts/component.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
layout: base
|
||||||
|
---
|
||||||
|
|
||||||
|
{% assign columns = page.columns | default: 0 %}
|
||||||
|
{% assign columns = 1 %}
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="d-flex align-items-center justify-content-center p-5" style="min-height: 50vh">
|
||||||
|
<div class="flex-fill "{% if columns > 0 %} style="max-width: {{ columns | times: 298 | minus: 24 }}px"{% endif %}>
|
||||||
|
{{ content }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{{ content | highlight_tidy }}
|
||||||
|
</div>
|
||||||
@@ -3,7 +3,9 @@ layout: base
|
|||||||
---
|
---
|
||||||
|
|
||||||
<div class="d-flex flex-row h-100p">
|
<div class="d-flex flex-row h-100p">
|
||||||
|
{% comment %}
|
||||||
{% include layout/sidenav.html dark=page.sidenav-dark folded=page.sidenav-folded fixed=true %}
|
{% include layout/sidenav.html dark=page.sidenav-dark folded=page.sidenav-folded fixed=true %}
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
<div class="layout-main d-flex flex-column flex-fill max-w-full">
|
<div class="layout-main d-flex flex-column flex-fill max-w-full">
|
||||||
{% include layout/topnav.html dark=page.header-dark sticky=page.header-sticky %}
|
{% include layout/topnav.html dark=page.header-dark sticky=page.header-sticky %}
|
||||||
|
|||||||
@@ -1,7 +1,30 @@
|
|||||||
require 'htmlbeautifier'
|
require 'htmlbeautifier'
|
||||||
|
|
||||||
|
def render_rouge(code, lang, line_numbers = false)
|
||||||
|
require 'rouge'
|
||||||
|
formatter = Rouge::Formatters::HTML.new(line_numbers: line_numbers, wrap: false)
|
||||||
|
lexer = Rouge::Lexer.find_fancy(lang, code) || Rouge::Lexers::PlainText
|
||||||
|
|
||||||
|
code = HtmlBeautifier.beautify(code, indent: "\t")
|
||||||
|
|
||||||
|
code = code.gsub(/<hide>.*?<\/hide>/, "")
|
||||||
|
code = formatter.format(lexer.lex(code))
|
||||||
|
code = code.strip.gsub /^[\t\s]*$\n/, ''
|
||||||
|
code = code.gsub /\t/, "\s\s\s"
|
||||||
|
code = code.gsub "javascript:void(0)", "#"
|
||||||
|
code = code.gsub "../", "./"
|
||||||
|
|
||||||
|
|
||||||
|
"<div class=\"highlight\"><pre>#{code}</pre></div>"
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_code_tag(code, lang)
|
||||||
|
code = code.sub(/<pre>\n*/, '<pre><code class="language-' + lang.to_s.gsub("+", "-") + '" data-lang="' + lang.to_s + '">')
|
||||||
|
code = code.sub(/\n*<\/pre>/, "</code></pre>")
|
||||||
|
code.strip
|
||||||
|
end
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Tags
|
|
||||||
class ExampleBlock < Liquid::Block
|
class ExampleBlock < Liquid::Block
|
||||||
include Liquid::StandardFilters
|
include Liquid::StandardFilters
|
||||||
|
|
||||||
@@ -48,12 +71,10 @@ Valid syntax: example <lang> [id=foo]
|
|||||||
output = case context.registers[:site].highlighter
|
output = case context.registers[:site].highlighter
|
||||||
|
|
||||||
when 'rouge'
|
when 'rouge'
|
||||||
render_rouge(code)
|
render_rouge(code, @lang, @options[:linenos])
|
||||||
end
|
end
|
||||||
|
|
||||||
# output = HtmlBeautifier.beautify(output, indent: "\t")
|
rendered_output = example(code) + add_code_tag(output, @lang)
|
||||||
|
|
||||||
rendered_output = example(code) + add_code_tag(output)
|
|
||||||
prefix + rendered_output + suffix
|
prefix + rendered_output + suffix
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -63,38 +84,15 @@ Valid syntax: example <lang> [id=foo]
|
|||||||
"<div class=\"example" + (@options[:columns] ? " example-bg" : "") + "\"" + (@options[:id] ? " data-example-id=\"#{@options[:id]}\"" : "") + ">\n" + (@options[:columns] ? "<div class=\"example-column example-column-" + @options[:columns] + "\">\n" : "") + (@options[:wrapper] ? "<div class=\"" + @options[:wrapper] + "\">\n" : "") + (@options[:"max-width"] ? "<div style=\"max-width: " + @options[:"max-width"] + "px; margin: 0 auto;\">\n" : "") + "#{output}" + (@options[:wrapper] ? "\n</div>" : "") + (@options[:columns] ? "\n</div>" : "") + (@options[:"max-width"] ? "\n</div>" : "") + "\n</div>"
|
"<div class=\"example" + (@options[:columns] ? " example-bg" : "") + "\"" + (@options[:id] ? " data-example-id=\"#{@options[:id]}\"" : "") + ">\n" + (@options[:columns] ? "<div class=\"example-column example-column-" + @options[:columns] + "\">\n" : "") + (@options[:wrapper] ? "<div class=\"" + @options[:wrapper] + "\">\n" : "") + (@options[:"max-width"] ? "<div style=\"max-width: " + @options[:"max-width"] + "px; margin: 0 auto;\">\n" : "") + "#{output}" + (@options[:wrapper] ? "\n</div>" : "") + (@options[:columns] ? "\n</div>" : "") + (@options[:"max-width"] ? "\n</div>" : "") + "\n</div>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_example_classes(code)
|
|
||||||
# Find `bd-` classes and remove them from the highlighted code. Because of how this regex works, it will also
|
|
||||||
# remove classes that are after the `bd-` class. While this is a bug, I left it because it can be helpful too.
|
|
||||||
# To fix the bug, replace `(?=")` with `(?=("|\ ))`.
|
|
||||||
code = code.gsub(/(?!class=".)\ *?bd-.+?(?=")/, "")
|
|
||||||
# Find empty class attributes after the previous regex and remove those too.
|
|
||||||
code = code.gsub(/\ class=""/, "")
|
|
||||||
end
|
|
||||||
|
|
||||||
def render_rouge(code)
|
|
||||||
require 'rouge'
|
|
||||||
formatter = Rouge::Formatters::HTML.new(line_numbers: @options[:linenos], wrap: false)
|
|
||||||
lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
|
|
||||||
code = remove_example_classes(code)
|
|
||||||
code = code.gsub(/<hide>.*?<\/hide>/, "")
|
|
||||||
code = formatter.format(lexer.lex(code))
|
|
||||||
code = code.strip.gsub /^[\t\s]*$\n/, ''
|
|
||||||
code = code.gsub /\t/, "\s\s"
|
|
||||||
code = code.gsub "javascript:void(0)", "#"
|
|
||||||
code = code.gsub "../", "./"
|
|
||||||
"<div class=\"highlight\"><pre>#{code}</pre></div>"
|
|
||||||
end
|
|
||||||
|
|
||||||
def add_code_tag(code)
|
|
||||||
# Add nested <code> tags to code blocks
|
|
||||||
code = code.sub(/<pre>\n*/, '<pre><code class="language-' + @lang.to_s.gsub("+", "-") + '" data-lang="' + @lang.to_s + '">')
|
|
||||||
code = code.sub(/\n*<\/pre>/, "</code></pre>")
|
|
||||||
code.strip
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module HightlightFilter
|
||||||
|
def highlight_tidy(code, language = 'html')
|
||||||
|
code = render_rouge(code, language)
|
||||||
|
add_code_tag(code, language)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_tag('example', Jekyll::Tags::ExampleBlock)
|
Liquid::Template.register_tag('example', Jekyll::ExampleBlock)
|
||||||
|
Liquid::Template.register_filter(Jekyll::HightlightFilter)
|
||||||
|
|||||||
11
pages/components.html
Normal file
11
pages/components.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: Table UI components
|
||||||
|
---
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<ul>
|
||||||
|
{% for component in site.components %}
|
||||||
|
<li><a href="{{ component.url }}">{{ component.title }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
@@ -83,10 +83,10 @@ pre {
|
|||||||
hyphens: none;
|
hyphens: none;
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
color: $gray-800;
|
color: $gray-800;
|
||||||
text-shadow: 0 1px #fff;
|
|
||||||
tab-size: 3;
|
tab-size: 3;
|
||||||
background-color: #f8fafc;
|
background-color: #f8fafc;
|
||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
|
-webkit-font-smoothing: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
|||||||
Reference in New Issue
Block a user